Skip to content
Draft
Show file tree
Hide file tree
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 @@ -223,7 +223,7 @@ class OmniUICoordinator: UINavigationController, PumpManagerOnboarding, Completi
self?.setupCanceled()
}
let controller = hostingController(rootView: view)
controller.navigationItem.title = pumpManager.localizedTitle
controller.navigationItem.title = LocalizedString("RileyLink Setup", comment: "Navigation title for RileyLinkSetupView")
return controller

case .deactivate:
Expand Down
1 change: 0 additions & 1 deletion OmnipodKit/PumpManagerUI/Views/AttachPodView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ struct AttachPodView: View {
.zIndex(1)
}
.alert(item: $activeModal, content: self.alert(for:))
.navigationTitle(LocalizedString("Attach Pod", comment: "navigation bar title attach pod"))
.navigationBarTitleDisplayMode(.automatic)
.navigationBarItems(trailing: cancelButton)
.navigationBarBackButtonHidden(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ struct BeepPreferenceSelectionView: View {

}
.insetGroupedListStyle()
.navigationTitle(LocalizedString("Confidence Reminders", comment: "navigation title for confidence reminders"))
.navigationBarTitleDisplayMode(.inline)
.uikitNavigationTitle(LocalizedString("Confidence Reminders", comment: "navigation title for confidence reminders"), displayMode: .inline)
.alert(isPresented: $alertIsPresented, content: { alert(error: error) })
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ struct CheckInsertedCannulaView: View {
}
.animation(.default, value: flashlightOn)
.alert(isPresented: $cancelModalIsPresented) { cancelPairingModal }
.navigationTitle(LocalizedString("Check Cannula", comment: "navigation title for Check Cannula"))
.navigationBarTitleDisplayMode(.automatic)
.navigationBarItems(trailing: cancelButton)
.navigationBarBackButtonHidden(true)
Expand Down
1 change: 0 additions & 1 deletion OmnipodKit/PumpManagerUI/Views/DeactivatePodView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ struct DeactivatePodView: View {
.padding()
}
.alert(isPresented: $removePodModalIsPresented) { removePodModal }
.navigationTitle(LocalizedString("Deactivate Pod", comment: "navigation title for Deactivate Pod"))
.navigationBarTitleDisplayMode(.automatic)
.navigationBarBackButtonHidden(true)
.navigationBarItems(trailing:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct DeliveryUncertaintyRecoveryView: View {
}
}
}
.navigationBarTitle(Text(LocalizedString("Unable to Reach Pod", comment: "Title of delivery uncertainty recovery page")), displayMode: .large)
.navigationBarTitleDisplayMode(.large)
.navigationBarItems(leading: backButton)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ struct ExpirationReminderSetupView: View {
}
.padding()
}
.navigationTitle(LocalizedString("Expiration Reminder", comment: "navigation title for Expiration Reminder"))
.navigationBarTitleDisplayMode(.automatic)
.navigationBarHidden(false)
.toolbar {
Expand Down
1 change: 0 additions & 1 deletion OmnipodKit/PumpManagerUI/Views/InsertCannulaView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ struct InsertCannulaView: View {
.padding()
}
.alert(isPresented: $cancelModalIsPresented) { cancelPairingModal }
.navigationTitle(LocalizedString("Insert Cannula", comment: "navigation bar title for insert cannula"))
.navigationBarTitleDisplayMode(.automatic)
.navigationBarBackButtonHidden(true)
.navigationBarItems(trailing: cancelButton)
Expand Down
1 change: 0 additions & 1 deletion OmnipodKit/PumpManagerUI/Views/LowReservoirView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ struct LowReservoirView: View {
}
}
}
.navigationTitle(title)
.navigationBarTitleDisplayMode(.automatic)
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ struct NotificationSettingsView: View {
comment: "Description text for Critical Alerts section")
)
}
.navigationTitle(
.uikitNavigationTitle(
LocalizedString("Notification Settings", comment: "navigation title for notification settings")
)
}
Expand Down
3 changes: 2 additions & 1 deletion OmnipodKit/PumpManagerUI/Views/OmniSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,8 @@ struct OmniSettingsView: View {
}
}

NavigationLink(destination: InsulinTypeSetting(initialValue: viewModel.insulinType, supportedInsulinTypes: supportedInsulinTypes, allowUnsetInsulinType: false, didChange: viewModel.didChangeInsulinType)) {
NavigationLink(destination: InsulinTypeSetting(initialValue: viewModel.insulinType, supportedInsulinTypes: supportedInsulinTypes, allowUnsetInsulinType: false, didChange: viewModel.didChangeInsulinType)
.uikitNavigationTitle(LocalizedString("Insulin Type", comment: "navigation title for insulin type"), displayMode: .inline)) {
HStack {
FrameworkLocalText("Insulin Type", comment: "Text for insulin type navigation link")
.foregroundColor(Color.primary)
Expand Down
1 change: 0 additions & 1 deletion OmnipodKit/PumpManagerUI/Views/PairPodView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ struct PairPodView: View {
}
.alert(isPresented: $cancelModalIsPresented) { cancelPairingModal }

.navigationTitle(String(format: LocalizedString("Pair %1$@ Pod", comment: "Title for pod pairing screen (1: pod type brief name)"), self.viewModel.podType.briefName))
.navigationBarTitleDisplayMode(.automatic)
.navigationBarBackButtonHidden(self.viewModel.backButtonHidden)
.navigationBarItems(trailing: self.viewModel.state.navBarVisible ? cancelButton : nil)
Expand Down
3 changes: 1 addition & 2 deletions OmnipodKit/PumpManagerUI/Views/PlayTestBeepsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ struct PlayTestBeepsView: View {
.background(Color(UIColor.secondarySystemGroupedBackground).shadow(radius: 5))
}
.insetGroupedListStyle()
.navigationTitle(title)
.navigationBarTitleDisplayMode(.inline)
.uikitNavigationTitle(title, displayMode: .inline)
.alert(isPresented: $alertIsPresented, content: { alert(error: error) })
.task {
await playTestBeepsAndHandleError()
Expand Down
3 changes: 1 addition & 2 deletions OmnipodKit/PumpManagerUI/Views/PodDetailsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ struct PodDetailsView: View {
}
}
}
.navigationTitle(title)
.navigationBarTitleDisplayMode(.automatic)
.uikitNavigationTitle(title)
}
}

Expand Down
2 changes: 1 addition & 1 deletion OmnipodKit/PumpManagerUI/Views/PodDiagnosticsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ struct PodDiagnosticsView: View {

}
.insetGroupedListStyle()
.navigationTitle(title)
.uikitNavigationTitle(title)
}
}
2 changes: 1 addition & 1 deletion OmnipodKit/PumpManagerUI/Views/PodKeepAliveView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct PodKeepAliveView: View {
self.forceRefresh.toggle()
}
.insetGroupedListStyle()
.navigationBarTitle(Text(title), displayMode: .automatic)
.uikitNavigationTitle(title)
}

// MARK: - Subviews / Computed Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ struct PumpManagerDetailsView: View {
.background(Color(UIColor.secondarySystemGroupedBackground).shadow(radius: 5))
}
.insetGroupedListStyle()
.navigationTitle(title)
.navigationBarTitleDisplayMode(.inline)
.uikitNavigationTitle(title, displayMode: .inline)
.task {
self.displayString = getPumpManagerDetails()
}
Expand Down
3 changes: 1 addition & 2 deletions OmnipodKit/PumpManagerUI/Views/ReadPodInfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ struct ReadPodInfoView: View {
.background(Color(UIColor.secondarySystemGroupedBackground).shadow(radius: 5))
}
.insetGroupedListStyle()
.navigationTitle(title)
.navigationBarTitleDisplayMode(.inline)
.uikitNavigationTitle(title, displayMode: .inline)
.alert(isPresented: $alertIsPresented, content: { alert(error: error) })
.task {
await attemptAction()
Expand Down
3 changes: 1 addition & 2 deletions OmnipodKit/PumpManagerUI/Views/ReadPodStatusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ struct ReadPodStatusView: View {
.background(Color(UIColor.secondarySystemGroupedBackground).shadow(radius: 5))
}
.insetGroupedListStyle()
.navigationTitle(title)
.navigationBarTitleDisplayMode(.inline)
.uikitNavigationTitle(title, displayMode: .inline)
.alert(isPresented: $alertIsPresented, content: { alert(error: error) })
.task {
await fetchDetailedStatus()
Expand Down
1 change: 0 additions & 1 deletion OmnipodKit/PumpManagerUI/Views/RileyLinkSetupView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ struct RileyLinkSetupView: View {
.padding([.bottom, .horizontal])

}
.navigationTitle(LocalizedString("RileyLink Setup", comment: "Navigation title for RileyLinkSetupView"))
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button(LocalizedString("Cancel", comment: "Cancel button title"), action: {
Expand Down
1 change: 0 additions & 1 deletion OmnipodKit/PumpManagerUI/Views/SetupCompleteView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ struct SetupCompleteView: View {
.background(Color(UIColor.systemBackground))
.zIndex(1)
}
.navigationTitle(LocalizedString("Setup Complete", comment: "Title of SetupCompleteView"))
.navigationBarTitleDisplayMode(.automatic)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ struct SilencePodSelectionView: View {
}
}
.insetGroupedListStyle()
.navigationTitle(LocalizedString("Silence Pod", comment: "navigation title for Silence Pod"))
.navigationBarTitleDisplayMode(.inline)
.uikitNavigationTitle(LocalizedString("Silence Pod", comment: "navigation title for Silence Pod"), displayMode: .inline)
.alert(isPresented: $alertIsPresented, content: { alert(error: error) })
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ struct UncertaintyRecoveredView: View {
}
}
}
.navigationTitle(LocalizedString("Comms Recovered", comment: "navigation title for comms recovered"))
.navigationBarTitleDisplayMode(.large)
.navigationBarBackButtonHidden(true)
}
Expand Down
91 changes: 91 additions & 0 deletions OmnipodKit/PumpManagerUI/Views/View+UIKitNavigationTitle.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
//
// View+UIKitNavigationTitle.swift
// OmnipodKit
//
// Copyright © 2026 LoopKit Authors. All rights reserved.
//

import SwiftUI
import UIKit

extension View {
/// Sets the navigation bar title (and large-title display mode) for a SwiftUI screen pushed
/// via `NavigationLink` while the flow is hosted inside a UIKit `UINavigationController`
/// (as the Omnipod settings screens are, via `OmniUICoordinator`).
func uikitNavigationTitle(
_ title: String,
displayMode: NavigationBarItem.TitleDisplayMode = .automatic
) -> some View {
self
.navigationTitle(title)
.navigationBarTitleDisplayMode(displayMode)
.background(NavigationItemTitleSetter(title: title, largeTitleDisplayMode: displayMode.uiKitLargeTitleDisplayMode))
}
}

private extension NavigationBarItem.TitleDisplayMode {
var uiKitLargeTitleDisplayMode: UINavigationItem.LargeTitleDisplayMode {
switch self {
case .inline: return .never
case .large: return .always
case .automatic: return .automatic
@unknown default: return .automatic
}
}
}

/// Sets `navigationItem.title` and `largeTitleDisplayMode` on the enclosing navigation
/// controller's top view controller. See `View.uikitNavigationTitle(_:displayMode:)`.
private struct NavigationItemTitleSetter: UIViewControllerRepresentable {
let title: String
let largeTitleDisplayMode: UINavigationItem.LargeTitleDisplayMode

func makeUIViewController(context: Context) -> TitleProxyViewController {
TitleProxyViewController(title: title, largeTitleDisplayMode: largeTitleDisplayMode)
}

func updateUIViewController(_ uiViewController: TitleProxyViewController, context: Context) {
uiViewController.proxyTitle = title
uiViewController.largeTitleDisplayMode = largeTitleDisplayMode
}

final class TitleProxyViewController: UIViewController {
var proxyTitle: String {
didSet { applyTitle() }
}

var largeTitleDisplayMode: UINavigationItem.LargeTitleDisplayMode {
didSet { applyTitle() }
}

init(title: String, largeTitleDisplayMode: UINavigationItem.LargeTitleDisplayMode) {
self.proxyTitle = title
self.largeTitleDisplayMode = largeTitleDisplayMode
super.init(nibName: nil, bundle: nil)
view.isHidden = true
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
applyTitle()
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
applyTitle()
}

private func applyTitle() {
// The pushed SwiftUI screen is the navigation controller's top view controller;
// set the title and display mode the navigation bar actually uses.
guard let host = navigationController?.topViewController else { return }
host.navigationItem.title = proxyTitle
host.navigationItem.largeTitleDisplayMode = largeTitleDisplayMode
}
}
}