diff --git a/LoopFollow/Controllers/Nightscout/DeviceStatusOpenAPS.swift b/LoopFollow/Controllers/Nightscout/DeviceStatusOpenAPS.swift index 4d4105fbb..ca8338a47 100644 --- a/LoopFollow/Controllers/Nightscout/DeviceStatusOpenAPS.swift +++ b/LoopFollow/Controllers/Nightscout/DeviceStatusOpenAPS.swift @@ -201,7 +201,7 @@ extension MainViewController { Storage.shared.lastMinBgMgdl.value = minPredBG Storage.shared.lastMaxBgMgdl.value = maxPredBG } else { - infoManager.updateInfoData(type: .minMax, value: "N/A") + infoManager.clearInfoData(type: .minMax) } updateOpenAPSPredictionDisplay() diff --git a/LoopFollow/InfoTable/InfoTableView.swift b/LoopFollow/InfoTable/InfoTableView.swift index 218b3fe70..948cd94d2 100644 --- a/LoopFollow/InfoTable/InfoTableView.swift +++ b/LoopFollow/InfoTable/InfoTableView.swift @@ -7,6 +7,9 @@ struct InfoTableView: View { @ObservedObject var infoManager: InfoManager var timeZoneOverride: String? + @ScaledMetric(relativeTo: .body) private var fontSize: CGFloat = 17 + @ScaledMetric(relativeTo: .body) private var rowHeight: CGFloat = 21 + var body: some View { List { if let tz = timeZoneOverride { @@ -17,18 +20,35 @@ struct InfoTableView: View { } } .listStyle(.plain) - .environment(\.defaultMinListRowHeight, 21) + .environment(\.defaultMinListRowHeight, rowHeight) } private func row(name: String, value: String) -> some View { - HStack { - Text(name) - Spacer() - Text(value) - .foregroundStyle(.primary) + // Show a placeholder for any field that has no value yet, + // so the row reads as "no data" rather than appearing empty. + let displayValue = value.isEmpty ? "—" : value + + return ViewThatFits(in: .horizontal) { + // Preferred: compact single line (label — value) + HStack { + Text(name) + Spacer() + Text(displayValue) + .foregroundStyle(.primary) + } + + // Fallback when the single line won't fit: label over value + VStack(alignment: .leading, spacing: 0) { + Text(name) + Text(displayValue) + .foregroundStyle(.primary) + .frame(maxWidth: .infinity, alignment: .trailing) + } } - .font(.system(size: 17)) - .frame(height: 21) + .font(.system(size: fontSize)) + .lineLimit(1) + .minimumScaleFactor(0.5) + .frame(minHeight: rowHeight) .listRowInsets(EdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 8)) } } diff --git a/LoopFollow/ViewControllers/MainHomeView.swift b/LoopFollow/ViewControllers/MainHomeView.swift index 6e933bbb8..e8509d94d 100644 --- a/LoopFollow/ViewControllers/MainHomeView.swift +++ b/LoopFollow/ViewControllers/MainHomeView.swift @@ -40,6 +40,7 @@ struct MainHomeView: View { if isNightscoutEnabled && !hideInfoTable.value { InfoTableView(infoManager: infoManager, timeZoneOverride: timeZoneOverride) + .dynamicTypeSize(...DynamicTypeSize.accessibility1) .frame(minWidth: 160, maxWidth: 250) .overlay( Rectangle()