Distinguish between Catalyst (macOS) and Mac iPad App (Designed for iPad): - Catalyst: Uses compact header (iPhone/iPad style) via IOSOnlyNavBar - Mac iPad App: Uses full custom header (macNavigationHeader) Added isTrueMacApp property to detect true Mac app vs Catalyst app. This fixes the navigation bar disappearing on Catalyst for connected meters. Also ensures offline meters (MeterDetailView) remain unchanged.
@@ -105,6 +105,9 @@ struct MeterView: View {
|
||
| 105 | 105 |
#else |
| 106 | 106 |
private static let isPhone: Bool = false |
| 107 | 107 |
#endif |
| 108 |
+ |
|
| 109 |
+ // True only on Mac iPad App (Designed for iPad), false on Catalyst |
|
| 110 |
+ private static let isTrueMacApp: Bool = ProcessInfo.processInfo.isiOSAppOnMac && !ProcessInfo.processInfo.isMacCatalystApp |
|
| 108 | 111 |
|
| 109 | 112 |
@State private var selectedMeterTab: MeterTab = .home |
| 110 | 113 |
@State private var navBarTitle: String = "Meter" |
@@ -127,8 +130,8 @@ struct MeterView: View {
|
||
| 127 | 130 |
) |
| 128 | 131 |
|
| 129 | 132 |
VStack(spacing: 0) {
|
| 130 |
- // Use compact header on Mac Catalyst (like iPhone), full custom header only on Mac iPad App |
|
| 131 |
- if Self.isMacIPadApp && !Self.isPhone {
|
|
| 133 |
+ // Use custom header only on true Mac iPad App (Designed for iPad on Mac) |
|
| 134 |
+ if Self.isTrueMacApp {
|
|
| 132 | 135 |
macNavigationHeader |
| 133 | 136 |
} |
| 134 | 137 |
Group {
|
@@ -150,14 +153,14 @@ struct MeterView: View {
|
||
| 150 | 153 |
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top) |
| 151 | 154 |
} |
| 152 | 155 |
#if !targetEnvironment(macCatalyst) |
| 153 |
- .navigationBarHidden(Self.isMacIPadApp && !Self.isPhone || landscape) |
|
| 156 |
+ .navigationBarHidden(Self.isTrueMacApp || landscape) |
|
| 154 | 157 |
#else |
| 155 | 158 |
.navigationBarHidden(landscape) |
| 156 | 159 |
#endif |
| 157 | 160 |
} |
| 158 | 161 |
.background(meterBackground) |
| 159 | 162 |
.modifier(IOSOnlyNavBar( |
| 160 |
- apply: !Self.isMacIPadApp || Self.isPhone, |
|
| 163 |
+ apply: !Self.isTrueMacApp, |
|
| 161 | 164 |
title: navBarTitle, |
| 162 | 165 |
showRSSI: navBarShowRSSI, |
| 163 | 166 |
rssi: navBarRSSI, |