Explorar el Código

add tap bar and align hamburger menu to the top right, remove "close" from tap bar main views... WiP...

polscm32 hace 2 años
padre
commit
2288506e1a
Se han modificado 35 ficheros con 257 adiciones y 250 borrados
  1. 1 8
      FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift
  2. 1 1
      FreeAPS/Sources/Modules/AddTempTarget/View/AddTempTargetRootView.swift
  3. 1 1
      FreeAPS/Sources/Modules/AutotuneConfig/View/AutotuneConfigRootView.swift
  4. 1 1
      FreeAPS/Sources/Modules/BasalProfileEditor/View/BasalProfileEditorRootView.swift
  5. 2 6
      FreeAPS/Sources/Modules/Bolus/View/AlternativeBolusCalcRootView.swift
  6. 2 6
      FreeAPS/Sources/Modules/Bolus/View/DefaultBolusCalcRootView.swift
  7. 1 1
      FreeAPS/Sources/Modules/BolusCalculatorConfig/View/BolusCalculatorConfigRootView.swift
  8. 1 1
      FreeAPS/Sources/Modules/CGM/View/CGMRootView.swift
  9. 1 1
      FreeAPS/Sources/Modules/CREditor/View/CREditorRootView.swift
  10. 1 1
      FreeAPS/Sources/Modules/Calibrations/View/CalibrationsRootView.swift
  11. 1 1
      FreeAPS/Sources/Modules/ConfigEditor/View/ConfigEditorRootView.swift
  12. 24 25
      FreeAPS/Sources/Modules/DataTable/View/DataTableRootView.swift
  13. 1 1
      FreeAPS/Sources/Modules/Dynamic/View/DynamicRootView.swift
  14. 1 1
      FreeAPS/Sources/Modules/FPUConfig/View/FPUConfigRootView.swift
  15. 1 1
      FreeAPS/Sources/Modules/HealthKit/View/AppleHealthKitRootView.swift
  16. 60 30
      FreeAPS/Sources/Modules/Home/View/HomeRootView.swift
  17. 1 1
      FreeAPS/Sources/Modules/ISFEditor/View/ISFEditorRootView.swift
  18. 1 1
      FreeAPS/Sources/Modules/IconConfig/View/IconConfigRootWiew.swift
  19. 1 1
      FreeAPS/Sources/Modules/LibreConfig/View/LibreConfigRootView.swift
  20. 1 1
      FreeAPS/Sources/Modules/Main/View/MainRootView.swift
  21. 1 1
      FreeAPS/Sources/Modules/ManualTempBasal/View/ManualTempBasalRootView.swift
  22. 1 1
      FreeAPS/Sources/Modules/NightscoutConfig/View/NightscoutConfigRootView.swift
  23. 40 40
      FreeAPS/Sources/Modules/NotificationsConfig/View/NotificationsConfigRootView.swift
  24. 0 7
      FreeAPS/Sources/Modules/OverrideProfilesConfig/View/OverrideProfilesRootView.swift
  25. 1 1
      FreeAPS/Sources/Modules/PreferencesEditor/View/PreferencesEditorRootView.swift
  26. 1 1
      FreeAPS/Sources/Modules/PumpConfig/View/PumpConfigRootView.swift
  27. 1 1
      FreeAPS/Sources/Modules/PumpSettingsEditor/View/PumpSettingsEditorRootView.swift
  28. 1 1
      FreeAPS/Sources/Modules/Settings/View/SettingsRootView.swift
  29. 1 1
      FreeAPS/Sources/Modules/Snooze/View/SnoozeRootView.swift
  30. 1 1
      FreeAPS/Sources/Modules/Stat/View/StatRootView.swift
  31. 1 1
      FreeAPS/Sources/Modules/StatConfig/View/StatConfigRootView.swift
  32. 1 1
      FreeAPS/Sources/Modules/TargetsEditor/View/TargetsEditorRootView.swift
  33. 1 1
      FreeAPS/Sources/Modules/WatchConfig/View/WatchConfigRootView.swift
  34. 19 19
      FreeAPS/Sources/Services/LiveActivity/LiveActivityBridge.swift
  35. 83 83
      LiveActivity/LiveActivity.swift

+ 1 - 8
FreeAPS/Sources/Modules/AddCarbs/View/AddCarbsRootView.swift

@@ -34,7 +34,7 @@ extension AddCarbs {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom
@@ -149,13 +149,6 @@ extension AddCarbs {
                 }
                 .navigationTitle("Add Meal")
                 .navigationBarTitleDisplayMode(.inline)
-                .toolbar {
-                    ToolbarItem(placement: .topBarLeading) {
-                        Button("Close") {
-                            state.hideModal()
-                        }
-                    }
-                }
         }
 
         private var presetPopover: some View {

+ 1 - 1
FreeAPS/Sources/Modules/AddTempTarget/View/AddTempTargetRootView.swift

@@ -29,7 +29,7 @@ extension AddTempTarget {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/AutotuneConfig/View/AutotuneConfigRootView.swift

@@ -12,7 +12,7 @@ extension AutotuneConfig {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/BasalProfileEditor/View/BasalProfileEditorRootView.swift

@@ -12,7 +12,7 @@ extension BasalProfileEditor {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 2 - 6
FreeAPS/Sources/Modules/Bolus/View/AlternativeBolusCalcRootView.swift

@@ -59,7 +59,7 @@ extension Bolus {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom
@@ -201,11 +201,7 @@ extension Bolus {
                 .navigationBarTitleDisplayMode(.inline)
                 .toolbar {
                     ToolbarItem(placement: .topBarLeading) {
-                        if !fetch {
-                            Button("Close") {
-                                state.hideModal()
-                            }
-                        } else {
+                        if fetch {
                             Button {
                                 keepForNextWiew = true
                                 state.backToCarbsView(complexEntry: true, meal, override: false)

+ 2 - 6
FreeAPS/Sources/Modules/Bolus/View/DefaultBolusCalcRootView.swift

@@ -39,7 +39,7 @@ extension Bolus {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom
@@ -170,11 +170,7 @@ extension Bolus {
                 .navigationBarTitleDisplayMode(.inline)
                 .toolbar {
                     ToolbarItem(placement: .topBarLeading) {
-                        if !fetch {
-                            Button("Close") {
-                                state.hideModal()
-                            }
-                        } else {
+                        if fetch {
                             Button {
                                 keepForNextWiew = true
                                 state.backToCarbsView(complexEntry: true, meal, override: false)

+ 1 - 1
FreeAPS/Sources/Modules/BolusCalculatorConfig/View/BolusCalculatorConfigRootView.swift

@@ -11,7 +11,7 @@ extension BolusCalculatorConfig {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/CGM/View/CGMRootView.swift

@@ -13,7 +13,7 @@ extension CGM {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/CREditor/View/CREditorRootView.swift

@@ -12,7 +12,7 @@ extension CREditor {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/Calibrations/View/CalibrationsRootView.swift

@@ -11,7 +11,7 @@ extension Calibrations {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/ConfigEditor/View/ConfigEditorRootView.swift

@@ -13,7 +13,7 @@ extension ConfigEditor {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 24 - 25
FreeAPS/Sources/Modules/DataTable/View/DataTableRootView.swift

@@ -61,7 +61,7 @@ extension DataTable {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom
@@ -106,22 +106,17 @@ extension DataTable {
                 .navigationTitle("History")
                 .navigationBarTitleDisplayMode(.inline)
                 .toolbar {
-                    ToolbarItem(placement: .topBarLeading) {
-                        Button("Close") {
-                            state.hideModal()
-                        }
-                    }
                     ToolbarItem(placement: .topBarTrailing) {
                         switch state.mode {
-                        case .treatments: addButton( {
-                            showExternalInsulin = true
-                            state.externalInsulinDate = Date()
-                        })
+                        case .treatments: addButton({
+                                showExternalInsulin = true
+                                state.externalInsulinDate = Date()
+                            })
                         case .meals: EmptyView()
                         case .glucose: addButton({
-                            showManualGlucose = true
-                            state.manualGlucose = 0 
-                        })
+                                showManualGlucose = true
+                                state.manualGlucose = 0
+                            })
                         }
                     }
                 }
@@ -133,8 +128,8 @@ extension DataTable {
                     addExternalInsulinView()
                 }
         }
-        
-         @ViewBuilder func addButton(_ action: @escaping () -> Void) -> some View {
+
+        @ViewBuilder func addButton(_ action: @escaping () -> Void) -> some View {
             Button(
                 action: action,
                 label: {
@@ -191,7 +186,7 @@ extension DataTable {
         private var glucoseList: some View {
             List {
                 HStack {
-                   Text("Values").foregroundStyle(.secondary)
+                    Text("Values").foregroundStyle(.secondary)
                     Spacer()
                     Text("Time").foregroundStyle(.secondary)
                 }
@@ -207,10 +202,10 @@ extension DataTable {
             }
         }
 
-       @ViewBuilder private func addGlucoseView() -> some View {
-             let limitLow: Decimal = state.units == .mmolL ? 0.8 : 14
-             let limitHigh: Decimal = state.units == .mmolL ? 40 : 720
-            
+        @ViewBuilder private func addGlucoseView() -> some View {
+            let limitLow: Decimal = state.units == .mmolL ? 0.8 : 14
+            let limitHigh: Decimal = state.units == .mmolL ? 40 : 720
+
             NavigationView {
                 VStack {
                     Form {
@@ -239,8 +234,12 @@ extension DataTable {
                                     .frame(maxWidth: .infinity, alignment: .center)
                                     .disabled(state.manualGlucose < limitLow || state.manualGlucose > limitHigh)
                             }
-                        }.listRowBackground(state.manualGlucose < limitLow || state.manualGlucose > limitHigh ? Color(.systemGray4) : Color(.systemBlue))
-                            .tint(.white)
+                        }
+                        .listRowBackground(
+                            state.manualGlucose < limitLow || state
+                                .manualGlucose > limitHigh ? Color(.systemGray4) : Color(.systemBlue)
+                        )
+                        .tint(.white)
                     }.scrollContentBackground(.hidden).background(color)
                 }
                 .onAppear(perform: configureView)
@@ -411,7 +410,7 @@ extension DataTable {
                         }
 
                         let amountWarningCondition = (state.externalInsulinAmount > state.maxBolus)
-                        
+
                         var listBackgroundColor: Color {
                             if amountWarningCondition {
                                 return Color.red
@@ -421,7 +420,7 @@ extension DataTable {
                                 return Color(.systemBlue)
                             }
                         }
-                        
+
                         var foregroundColor: Color {
                             if amountWarningCondition {
                                 return Color.white
@@ -465,7 +464,7 @@ extension DataTable {
                     ToolbarItem(placement: .topBarLeading) {
                         Button("Close") {
                             showExternalInsulin = false
-                           state.externalInsulinAmount = 0
+                            state.externalInsulinAmount = 0
                         }
                     }
                 }

+ 1 - 1
FreeAPS/Sources/Modules/Dynamic/View/DynamicRootView.swift

@@ -19,7 +19,7 @@ extension Dynamic {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/FPUConfig/View/FPUConfigRootView.swift

@@ -11,7 +11,7 @@ extension FPUConfig {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/HealthKit/View/AppleHealthKitRootView.swift

@@ -11,7 +11,7 @@ extension AppleHealthKit {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 60 - 30
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -129,6 +129,14 @@ extension Home {
                 )
         }
 
+        private var historySFSymbol: String {
+            if #available(iOS 17.0, *) {
+                return "book.pages"
+            } else {
+                return "book"
+            }
+        }
+
         var glucoseView: some View {
             CurrentGlucoseView(
                 recentGlucose: $state.recentGlucose,
@@ -789,16 +797,6 @@ extension Home {
 
                 menuElements(action: { state.showModal(for: .settings) }, systemName: "gear", title: "Settings")
 
-                /* HStack {
-                     Image(systemName: "applewatch.watchface")
-                         .font(.system(size: 21))
-                         .foregroundColor(Color.insulinTintColor)
-                     Text("Watch Settings")
-                         .font(.system(size: 19))
-                 }.padding(.horizontal, 1)
-
-                 */
-
                 Spacer()
             }.padding(.trailing, 70)
                 .frame(width: UIScreen.main.bounds.width / 1.2, height: UIScreen.main.bounds.height - 20)
@@ -807,13 +805,11 @@ extension Home {
                         .ignoresSafeArea(edges: .all)
                 }
         }
-        
+
         @ViewBuilder func mainView() -> some View {
             GeometryReader { geo in
                 ZStack(alignment: .trailing) {
                     VStack(spacing: 0) {
-                        Spacer()
-
                         ZStack {
                             /// glucose bobble
                             glucoseView
@@ -831,13 +827,20 @@ extension Home {
                                 Spacer()
                             }.padding(.leading, 20)
 
-                        }.padding(.top, 40)
-
-                        Spacer()
+                            HStack {
+                                Spacer()
+                                Button {
+                                    isMenuPresented.toggle()
+                                }
+                                label: {
+                                    Image(systemName: "text.justify")
+                                        .font(.body).foregroundStyle(colorScheme == .dark ? Color.white : Color.black)
+                                }.padding(.trailing, 20).padding(.bottom, 110)
+                            }
 
-                        mealPanel(geo)
+                        }.padding(.top, 70)
 
-                        Spacer()
+                        mealPanel(geo).padding(.vertical, 25)
 
                         profileView(geo).padding(.vertical)
 
@@ -846,21 +849,23 @@ extension Home {
                             .overlay(mainChart)
                             .clipShape(RoundedRectangle(cornerRadius: 15))
                             .shadow(
-                                color: colorScheme == .dark ? Color(red: 0.02745098039, green: 0.1098039216, blue: 0.1411764706) :
+                                color: colorScheme == .dark ? Color(
+                                    red: 0.02745098039,
+                                    green: 0.1098039216,
+                                    blue: 0.1411764706
+                                ) :
                                     Color.black.opacity(0.33),
                                 radius: 3
                             )
                             .padding(.horizontal, 10)
                             .frame(maxHeight: UIScreen.main.bounds.height / 2.1)
 
-                        Spacer()
-
-                        timeInterval
+                        timeInterval.padding(.top, 25)
 
                         Spacer()
 
                         ZStack(alignment: .bottom) {
-                            bottomPanel(geo)
+                            // bottomPanel(geo)
 
                             if let progress = state.bolusProgress {
                                 bolusProgressView(geo, progress)
@@ -868,12 +873,7 @@ extension Home {
                         }
                     }
 
-                    // burger menu
-                    if isMenuPresented {
-                        HStack {
-                            sideMenuView().background(Color.chart).ignoresSafeArea(.all)
-                        }
-                    }
+                    // tabbar
                 }
                 .background(color)
                 .edgesIgnoringSafeArea(.all)
@@ -912,8 +912,38 @@ extension Home {
             }
         }
 
+        @ViewBuilder func tapBar() -> some View {
+            TabView {
+                mainView().tabItem { Label("Home", systemImage: "house") }
+
+                NavigationStack { DataTable.RootView(resolver: resolver) }
+                    .tabItem { Label("History", systemImage: historySFSymbol) }
+
+                NavigationStack { AddCarbs.RootView(resolver: resolver, editMode: false, override: false) }
+                    .tabItem { Label("Carbs", systemImage: "fork.knife") }
+
+                NavigationStack { Bolus.RootView(resolver: resolver, waitForSuggestion: false, fetch: false) }
+                    .tabItem { Label("Bolus", systemImage: "syringe.fill") }
+
+                NavigationStack { OverrideProfilesConfig.RootView(resolver: resolver) }
+                    .tabItem {
+                        Label(
+                            "Profile",
+                            systemImage: state.isTempTargetActive || overrideString != nil ? "person.fill" : "person"
+                        ) }
+            }
+        }
+
         var body: some View {
-            mainView()
+            ZStack(alignment: .trailing) {
+                tapBar()
+                // burger menu
+                if isMenuPresented {
+                    HStack {
+                        sideMenuView().background(Color.chart).ignoresSafeArea(.all)
+                    }
+                }
+            }
         }
 
         private var popup: some View {

+ 1 - 1
FreeAPS/Sources/Modules/ISFEditor/View/ISFEditorRootView.swift

@@ -12,7 +12,7 @@ extension ISFEditor {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/IconConfig/View/IconConfigRootWiew.swift

@@ -8,7 +8,7 @@ extension IconConfig {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/LibreConfig/View/LibreConfigRootView.swift

@@ -12,7 +12,7 @@ extension LibreConfig {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/Main/View/MainRootView.swift

@@ -11,7 +11,7 @@ extension Main {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/ManualTempBasal/View/ManualTempBasalRootView.swift

@@ -11,7 +11,7 @@ extension ManualTempBasal {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/NightscoutConfig/View/NightscoutConfigRootView.swift

@@ -15,7 +15,7 @@ extension NightscoutConfig {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 40 - 40
FreeAPS/Sources/Modules/NotificationsConfig/View/NotificationsConfigRootView.swift

@@ -1,20 +1,20 @@
-import SwiftUI
-import Swinject
 import ActivityKit
 import Combine
+import SwiftUI
+import Swinject
 
 extension NotificationsConfig {
     struct RootView: BaseView {
         let resolver: Resolver
         @StateObject var state = StateModel()
-        
+
         @State private var systemLiveActivitySetting: Bool = {
-               if #available(iOS 16.1, *) {
-                   ActivityAuthorizationInfo().areActivitiesEnabled
-               } else {
-                   false
-               }
-           }()
+            if #available(iOS 16.1, *) {
+                ActivityAuthorizationInfo().areActivitiesEnabled
+            } else {
+                false
+            }
+        }()
 
         private var glucoseFormatter: NumberFormatter {
             let formatter = NumberFormatter()
@@ -40,7 +40,7 @@ extension NotificationsConfig {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom
@@ -52,41 +52,41 @@ extension NotificationsConfig {
                     endPoint: .bottom
                 )
         }
-        
+
         @ViewBuilder private func liveActivitySection() -> some View {
             if #available(iOS 16.2, *) {
-                              Section(
-                                  header: Text("Live Activity"),
-                                  footer: Text(
-                                      liveActivityFooterText()
-                                  ),
-                                  content: {
-                                      if !systemLiveActivitySetting {
-                                          Button("Open Settings App") {
-                                              UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!)
-                                          }
-                                      } else {
-                                          Toggle("Show Live Activity", isOn: $state.useLiveActivity) }
-                                  }
-                              )
-                              .onReceive(resolver.resolve(LiveActivityBridge.self)!.$systemEnabled, perform: {
-                                  self.systemLiveActivitySetting = $0
-                              })
-                          }
+                Section(
+                    header: Text("Live Activity"),
+                    footer: Text(
+                        liveActivityFooterText()
+                    ),
+                    content: {
+                        if !systemLiveActivitySetting {
+                            Button("Open Settings App") {
+                                UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!)
+                            }
+                        } else {
+                            Toggle("Show Live Activity", isOn: $state.useLiveActivity) }
+                    }
+                )
+                .onReceive(resolver.resolve(LiveActivityBridge.self)!.$systemEnabled, perform: {
+                    self.systemLiveActivitySetting = $0
+                })
+            }
         }
-        
+
         private func liveActivityFooterText() -> String {
-                 var footer =
-                     "Live activity displays blood glucose live on the lock screen and on the dynamic island (if available)"
+            var footer =
+                "Live activity displays blood glucose live on the lock screen and on the dynamic island (if available)"
 
-                 if !systemLiveActivitySetting {
-                     footer =
-                         "Live activities are turned OFF in system settings. To enable live activities, go to Settings app -> iAPS -> Turn live Activities ON.\n\n" +
-                         footer
-                 }
+            if !systemLiveActivitySetting {
+                footer =
+                    "Live activities are turned OFF in system settings. To enable live activities, go to Settings app -> iAPS -> Turn live Activities ON.\n\n" +
+                    footer
+            }
 
-                 return footer
-             }
+            return footer
+        }
 
         var body: some View {
             Form {
@@ -119,7 +119,7 @@ extension NotificationsConfig {
                         Text("g").foregroundColor(.secondary)
                     }
                 }
-                
+
                 liveActivitySection()
             }.scrollContentBackground(.hidden).background(color)
                 .onAppear(perform: configureView)

+ 0 - 7
FreeAPS/Sources/Modules/OverrideProfilesConfig/View/OverrideProfilesRootView.swift

@@ -288,13 +288,6 @@ extension OverrideProfilesConfig {
                 .onAppear { state.savedSettings() }
                 .navigationBarTitle("Profiles")
                 .navigationBarTitleDisplayMode(.inline)
-                .toolbar {
-                    ToolbarItem(placement: .navigationBarLeading) {
-                        Button("Close") {
-                            state.hideModal()
-                        }
-                    }
-                }
         }
 
         @ViewBuilder private func profilesView(for preset: OverridePresets) -> some View {

+ 1 - 1
FreeAPS/Sources/Modules/PreferencesEditor/View/PreferencesEditorRootView.swift

@@ -17,7 +17,7 @@ extension PreferencesEditor {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/PumpConfig/View/PumpConfigRootView.swift

@@ -11,7 +11,7 @@ extension PumpConfig {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/PumpSettingsEditor/View/PumpSettingsEditorRootView.swift

@@ -11,7 +11,7 @@ extension PumpSettingsEditor {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/Settings/View/SettingsRootView.swift

@@ -14,7 +14,7 @@ extension Settings {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/Snooze/View/SnoozeRootView.swift

@@ -12,7 +12,7 @@ extension Snooze {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/Stat/View/StatRootView.swift

@@ -41,7 +41,7 @@ extension Stat {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/StatConfig/View/StatConfigRootView.swift

@@ -11,7 +11,7 @@ extension StatConfig {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/TargetsEditor/View/TargetsEditorRootView.swift

@@ -12,7 +12,7 @@ extension TargetsEditor {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 1 - 1
FreeAPS/Sources/Modules/WatchConfig/View/WatchConfigRootView.swift

@@ -11,7 +11,7 @@ extension WatchConfig {
             colorScheme == .dark ? LinearGradient(
                 gradient: Gradient(colors: [
                     Color.bgDarkBlue,
-                   Color.bgDarkerDarkBlue
+                    Color.bgDarkerDarkBlue
                 ]),
                 startPoint: .top,
                 endPoint: .bottom

+ 19 - 19
FreeAPS/Sources/Services/LiveActivity/LiveActivityBridge.swift

@@ -34,9 +34,9 @@ extension LiveActivityAttributes.ContentState {
         }
 
         let formattedBG = Self.formatGlucose(glucose, mmol: mmol, forceSign: false)
-        
+
         var rotationDegrees: Double = 0.0
-        
+
         switch bg.direction {
         case .doubleUp,
              .singleUp,
@@ -58,7 +58,7 @@ extension LiveActivityAttributes.ContentState {
              .some(.none):
             rotationDegrees = 0
         }
-        
+
         let trendString = bg.direction?.symbol
 
         let change = prev?.glucose.map({
@@ -123,9 +123,9 @@ extension LiveActivityAttributes.ContentState {
     @Injected() private var glucoseStorage: GlucoseStorage!
     @Injected() private var broadcaster: Broadcaster!
     @Injected() private var storage: FileStorage!
-    
+
     private let activityAuthorizationInfo = ActivityAuthorizationInfo()
-       @Published private(set) var systemEnabled: Bool
+    @Published private(set) var systemEnabled: Bool
 
     private var settings: FreeAPSSettings {
         settingsManager.settings
@@ -158,7 +158,7 @@ extension LiveActivityAttributes.ContentState {
         ) { _ in
             self.forceActivityUpdate()
         }
-       
+
         monitorForLiveActivityAuthorizationChanges()
     }
 
@@ -207,9 +207,9 @@ extension LiveActivityAttributes.ContentState {
                 await pushUpdate(state)
             } else {
                 let content = ActivityContent(
-                                   state: state,
-                                   staleDate: min(state.date, Date.now).addingTimeInterval(TimeInterval(6 * 60))
-                               )
+                    state: state,
+                    staleDate: min(state.date, Date.now).addingTimeInterval(TimeInterval(6 * 60))
+                )
                 await currentActivity.activity.update(content)
             }
         } else {
@@ -241,9 +241,9 @@ extension LiveActivityAttributes.ContentState {
                     pushType: nil
                 )
                 currentActivity = ActiveActivity(activity: activity, startDate: Date.now)
-                
+
                 // then show the actual content
-               await pushUpdate(state)
+                await pushUpdate(state)
             } catch {
                 print("activity creation error: \(error)")
             }
@@ -268,14 +268,14 @@ extension LiveActivityAttributes.ContentState {
 extension LiveActivityBridge: GlucoseObserver {
     func glucoseDidUpdate(_ glucose: [BloodGlucose]) {
         guard settings.useLiveActivity else {
-                   if currentActivity != nil {
-                       Task {
-                           await self.endActivity()
-                       }
-                   }
-                   return
-               }
-        
+            if currentActivity != nil {
+                Task {
+                    await self.endActivity()
+                }
+            }
+            return
+        }
+
         // backfill latest glucose if contained in this update
         if glucose.count > 1 {
             latestGlucose = glucose[glucose.count - 2]

+ 83 - 83
LiveActivity/LiveActivity.swift

@@ -73,20 +73,20 @@ struct LiveActivity: Widget {
             }
         }
     }
-    
+
     private func updatedLabel(context: ActivityViewContext<LiveActivityAttributes>) -> Text {
-            let text = Text("Updated: \(dateFormatter.string(from: context.state.date))")
-            if context.isStale {
-                if #available(iOSApplicationExtension 17.0, *) {
-                    return text.bold().foregroundStyle(.red)
-                } else {
-                    return text.bold().foregroundColor(.red)
-                }
+        let text = Text("Updated: \(dateFormatter.string(from: context.state.date))")
+        if context.isStale {
+            if #available(iOSApplicationExtension 17.0, *) {
+                return text.bold().foregroundStyle(.red)
             } else {
-                return text
+                return text.bold().foregroundColor(.red)
             }
+        } else {
+            return text
         }
-    
+    }
+
     private func bgLabel(context: ActivityViewContext<LiveActivityAttributes>) -> Text {
         Text(context.state.bg)
             .fontWeight(.bold)
@@ -94,63 +94,63 @@ struct LiveActivity: Widget {
     }
 
     private func bgAndTrend(context: ActivityViewContext<LiveActivityAttributes>, size: Size) -> (some View, Int) {
-          var characters = 0
+        var characters = 0
 
-          let bgText = context.state.bg
-          characters += bgText.count
+        let bgText = context.state.bg
+        characters += bgText.count
 
-          // narrow mode is for the minimal dynamic island view
-          // there is not enough space to show all three arrow there
-          // and everything has to be squeezed together to some degree
-          // only display the first arrow character and make it red in case there were more characters
-          var directionText: String?
-          var warnColor: Color?
-          if let direction = context.state.direction {
-              if size == .compact {
-                  directionText = String(direction[direction.startIndex ... direction.startIndex])
+        // narrow mode is for the minimal dynamic island view
+        // there is not enough space to show all three arrow there
+        // and everything has to be squeezed together to some degree
+        // only display the first arrow character and make it red in case there were more characters
+        var directionText: String?
+        var warnColor: Color?
+        if let direction = context.state.direction {
+            if size == .compact {
+                directionText = String(direction[direction.startIndex ... direction.startIndex])
 
-                  if direction.count > 1 {
-                      warnColor = Color.red
-                  }
-              } else {
-                  directionText = direction
-              }
+                if direction.count > 1 {
+                    warnColor = Color.red
+                }
+            } else {
+                directionText = direction
+            }
 
-              characters += directionText!.count
-          }
+            characters += directionText!.count
+        }
 
-          let spacing: CGFloat
-          switch size {
-          case .minimal: spacing = -1
-          case .compact: spacing = 0
-          case .expanded: spacing = 3
-          }
+        let spacing: CGFloat
+        switch size {
+        case .minimal: spacing = -1
+        case .compact: spacing = 0
+        case .expanded: spacing = 3
+        }
 
-          let stack = HStack(spacing: spacing) {
-              Text(bgText)
-                  .strikethrough(context.isStale, pattern: .solid, color: .red.opacity(0.6))
-              if let direction = directionText {
-                  let text = Text(direction)
-                  switch size {
-                  case .minimal:
-                      let scaledText = text.scaleEffect(x: 0.7, y: 0.7, anchor: .leading)
-                      if let warnColor {
-                          scaledText.foregroundStyle(warnColor)
-                      } else {
-                          scaledText
-                      }
-                  case .compact:
-                      text.scaleEffect(x: 0.8, y: 0.8, anchor: .leading).padding(.trailing, -3)
+        let stack = HStack(spacing: spacing) {
+            Text(bgText)
+                .strikethrough(context.isStale, pattern: .solid, color: .red.opacity(0.6))
+            if let direction = directionText {
+                let text = Text(direction)
+                switch size {
+                case .minimal:
+                    let scaledText = text.scaleEffect(x: 0.7, y: 0.7, anchor: .leading)
+                    if let warnColor {
+                        scaledText.foregroundStyle(warnColor)
+                    } else {
+                        scaledText
+                    }
+                case .compact:
+                    text.scaleEffect(x: 0.8, y: 0.8, anchor: .leading).padding(.trailing, -3)
 
-                  case .expanded:
-                      text.scaleEffect(x: 0.7, y: 0.7, anchor: .leading).padding(.trailing, -5)
-                  }
-              }
-          }
-          .foregroundStyle(context.isStale ? Color.primary.opacity(0.5) : Color.primary)
+                case .expanded:
+                    text.scaleEffect(x: 0.7, y: 0.7, anchor: .leading).padding(.trailing, -5)
+                }
+            }
+        }
+        .foregroundStyle(context.isStale ? Color.primary.opacity(0.5) : Color.primary)
 
-          return (stack, characters)
-      }
+        return (stack, characters)
+    }
 
     @ViewBuilder func bobble(context: ActivityViewContext<LiveActivityAttributes>) -> some View {
         @State var angularGradient = AngularGradient(colors: [
@@ -223,13 +223,13 @@ struct LiveActivity: Widget {
                     }
                 }
                 .privacySensitive()
-               .padding(.all, 15)
-               // Semantic BackgroundStyle and Color values work here. They adapt to the given interface style (light mode, dark mode)
-               // Semantic UIColors do NOT (as of iOS 17.1.1). Like UIColor.systemBackgroundColor (it does not adapt to changes of the interface style)
-               // The colorScheme environment varaible that is usually used to detect dark mode does NOT work here (it reports false values)
-               .foregroundStyle(Color.primary)
-               .background(BackgroundStyle.background.opacity(0.4))
-               .activityBackgroundTint(Color.clear)
+                .padding(.all, 15)
+                // Semantic BackgroundStyle and Color values work here. They adapt to the given interface style (light mode, dark mode)
+                // Semantic UIColors do NOT (as of iOS 17.1.1). Like UIColor.systemBackgroundColor (it does not adapt to changes of the interface style)
+                // The colorScheme environment varaible that is usually used to detect dark mode does NOT work here (it reports false values)
+                .foregroundStyle(Color.primary)
+                .background(BackgroundStyle.background.opacity(0.4))
+                .activityBackgroundTint(Color.clear)
             } else {
                 HStack(spacing: 2) {
                     VStack {
@@ -271,12 +271,12 @@ struct LiveActivity: Widget {
                 DynamicIslandExpandedRegion(.bottom) {
                     if context.state.lockScreenView == "Simple" {
                         Group {
-                             updatedLabel(context: context).font(.caption).foregroundStyle(Color.secondary)
-                         }
-                         .frame(
-                             maxHeight: .infinity,
-                             alignment: .bottom
-                         )
+                            updatedLabel(context: context).font(.caption).foregroundStyle(Color.secondary)
+                        }
+                        .frame(
+                            maxHeight: .infinity,
+                            alignment: .bottom
+                        )
                     } else {
                         chart(context: context)
                     }
@@ -293,21 +293,21 @@ struct LiveActivity: Widget {
             } minimal: {
                 let (_label, characterCount) = bgAndTrend(context: context, size: .minimal)
 
-              let label = _label.padding(.leading, 7).padding(.trailing, 3)
+                let label = _label.padding(.leading, 7).padding(.trailing, 3)
 
-              if characterCount < 4 {
-                  label
-              } else if characterCount < 5 {
-                  label.fontWidth(.condensed)
-              } else {
-                  label.fontWidth(.compressed)
-              }
+                if characterCount < 4 {
+                    label
+                } else if characterCount < 5 {
+                    label.fontWidth(.condensed)
+                } else {
+                    label.fontWidth(.compressed)
+                }
             }
             .widgetURL(URL(string: "freeaps-x://"))
             .keylineTint(Color.purple)
-           .contentMargins(.horizontal, 0, for: .minimal)
-           .contentMargins(.trailing, 0, for: .compactLeading)
-           .contentMargins(.leading, 0, for: .compactTrailing)
+            .contentMargins(.horizontal, 0, for: .minimal)
+            .contentMargins(.trailing, 0, for: .compactLeading)
+            .contentMargins(.leading, 0, for: .compactTrailing)
         }
     }
 }