From 5f8cba4bac7eb9882e59037b2bbdd2978862514c Mon Sep 17 00:00:00 2001 From: Arun Philip Date: Sat, 8 Jul 2023 13:37:20 -0400 Subject: [PATCH 1/2] Ensure app can be built on xcode 14, since xcode 15 is in beta --- App/Modules/AppleExport/AppleCalendarExport.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/App/Modules/AppleExport/AppleCalendarExport.swift b/App/Modules/AppleExport/AppleCalendarExport.swift index d5eb554f3..26337abf5 100644 --- a/App/Modules/AppleExport/AppleCalendarExport.swift +++ b/App/Modules/AppleExport/AppleCalendarExport.swift @@ -88,6 +88,7 @@ private class AppleCalendarExportService { lazy var eventStore: EKEventStore = .init() func requestAccess(completionHandler: @escaping CalendarExportHandler) { + #if swift(>=5.9) if #available(iOS 17.0, *) { eventStore.requestFullAccessToEvents { granted, error in if granted, error == nil { @@ -97,6 +98,7 @@ private class AppleCalendarExportService { } } } else { + #endif eventStore.requestAccess(to: EKEntityType.event, completion: { granted, error in if granted, error == nil { completionHandler(true) @@ -104,7 +106,9 @@ private class AppleCalendarExportService { completionHandler(false) } }) + #if swift(>=5.9) } + #endif } func clearGlucoseEvents() { From 06f7824cd186614434f10a36efd359ae6a89b5d4 Mon Sep 17 00:00:00 2001 From: Arun Philip Date: Fri, 14 Jul 2023 20:30:34 -0400 Subject: [PATCH 2/2] add visual indication when stats are unavailable --- App/Views/Lists/StatisticsView.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/App/Views/Lists/StatisticsView.swift b/App/Views/Lists/StatisticsView.swift index 170d25b5f..4399b6487 100644 --- a/App/Views/Lists/StatisticsView.swift +++ b/App/Views/Lists/StatisticsView.swift @@ -60,6 +60,8 @@ struct StatisticsView: View { Spacer() ForEach(Config.chartLevels, id: \.days) { level in + let levelDisabled = level.days > glucoseStatistics.maxDays + Spacer() Button( action: { @@ -71,16 +73,19 @@ struct StatisticsView: View { .if(isSelectedChartLevel(days: level.days)) { $0.fill(Color.ui.label) } else: { - $0.stroke(Color.ui.label) + $0.stroke(levelDisabled ? Color.ui.gray : Color.ui.label ) } .frame(width: 12, height: 12) Text(verbatim: level.name) + .if(levelDisabled) { + $0.strikethrough() + } .font(.subheadline) - .foregroundColor(Color.ui.label) + .foregroundColor(levelDisabled ? Color.ui.gray : Color.ui.label) } ) - .disabled(level.days > glucoseStatistics.maxDays) + .disabled(levelDisabled) .lineLimit(1) .buttonStyle(.plain) }