Sfoglia il codice sorgente

Merge branch 'tempTargets' of github.com:dnzxy/Trio-dev into tempTargets

Deniz Cengiz 1 anno fa
parent
commit
863ab4af30

+ 2 - 2
FreeAPS/Sources/Models/DecimalPickerSettings.swift

@@ -71,9 +71,9 @@ struct DecimalPickerSettings {
     var smbDeliveryRatio = PickerSetting(value: 0.5, step: 0.05, min: 0.3, max: 0.7, type: PickerSetting.PickerSettingType.factor)
     var halfBasalExerciseTarget = PickerSetting(
         value: 160,
-        step: 1,
+        step: 5,
         min: 100,
-        max: 200,
+        max: 300,
         type: PickerSetting.PickerSettingType.glucose
     )
     var maxCOB = PickerSetting(value: 120, step: 5, min: 0, max: 300, type: PickerSetting.PickerSettingType.gramms)

+ 3 - 1
FreeAPS/Sources/Modules/Home/View/Chart/DummyCharts.swift

@@ -38,7 +38,9 @@ extension MainChartView {
             }
         }
         .id("DummyMainChart")
-        .frame(minHeight: geo.size.height * 0.28)
+        .frame(
+            minHeight: geo.size.height * (0.28 - safeAreaSize)
+        )
         .frame(width: screenSize.width - 10)
         .chartXAxis { mainChartXAxis }
         .chartXScale(domain: startMarker ... endMarker)

+ 4 - 1
FreeAPS/Sources/Modules/Home/View/Chart/MainChartView.swift

@@ -7,6 +7,7 @@ let calendar = Calendar.current
 
 struct MainChartView: View {
     var geo: GeometryProxy
+    var safeAreaSize: CGFloat
     var units: GlucoseUnits
     var hours: Int
     var tempTargets: [TempTarget]
@@ -213,7 +214,9 @@ extension MainChartView {
             .onChange(of: state.insulinFromPersistence) {
                 state.roundedTotalBolus = state.calculateTINS()
             }
-            .frame(minHeight: geo.size.height * 0.28)
+            .frame(
+                minHeight: geo.size.height * (0.28 - safeAreaSize)
+            )
             .frame(width: fullWidth(viewWidth: screenSize.width))
             .chartXScale(domain: startMarker ... endMarker)
             .chartXAxis { mainChartXAxis }

+ 8 - 12
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -7,6 +7,7 @@ import Swinject
 extension Home {
     struct RootView: BaseView {
         let resolver: Resolver
+        let safeAreaSize: CGFloat = 0.08
 
         @State var state = StateModel()
         @State var isStatusPopupPresented = false
@@ -21,7 +22,6 @@ extension Home {
         @State private var statusTitle: String = ""
         @State var showPumpSelection: Bool = false
         @State var notificationsDisabled = false
-        @State var alertSafetyNotificationsViewHeight = 0
 
         struct Buttons: Identifiable {
             let label: String
@@ -335,6 +335,7 @@ extension Home {
             ZStack {
                 MainChartView(
                     geo: geo,
+                    safeAreaSize: notificationsDisabled == true ? safeAreaSize : 0,
                     units: state.units,
                     hours: state.filteredHours,
                     tempTargets: state.tempTargets,
@@ -792,7 +793,7 @@ extension Home {
                         )
                     )
                     .clipShape(RoundedRectangle(cornerRadius: 15))
-                    .frame(height: geo.size.height * 0.08)
+                    .frame(height: geo.size.height * safeAreaSize)
                     .coordinateSpace(name: "alertSafetyNotificationsView")
                     .shadow(
                         color: colorScheme == .dark ? Color(red: 0.02745098039, green: 0.1098039216, blue: 0.1411764706) :
@@ -843,17 +844,12 @@ extension Home {
                         pumpView
                         Spacer()
                     }.padding(.leading, 20)
-
-                    if notificationsDisabled {
-                        alertSafetyNotificationsView(geo: geo)
-                            // maybe experiment with safeAreaInset() or similar to avoid overlapping with the dynamic island
-                            .offset(
-                                y: -geo.size
-                                    .height *
-                                    0.075
-                            )
-                    }
                 }.padding(.top, 10)
+                    .safeAreaInset(edge: .top, spacing: 0) {
+                        if notificationsDisabled {
+                            alertSafetyNotificationsView(geo: geo)
+                        }
+                    }
 
                 mealPanel(geo).padding(.top, UIDevice.adjustPadding(min: nil, max: 30))
                     .padding(.bottom, UIDevice.adjustPadding(min: nil, max: 20))

+ 1 - 1
FreeAPS/Sources/Router/Router.swift

@@ -21,7 +21,7 @@ enum MessageSubtype: String {
 struct MessageContent {
     var content: String
     var type: MessageType = .info
-    var subtype: MessageSubtype = .misc
+    var subtype: MessageSubtype = .algorithm
     var title: String = ""
     var useAPN: Bool = true
     var trigger: UNNotificationTrigger? = nil

+ 3 - 1
FreeAPS/Sources/Services/WatchManager/GarminManager.swift

@@ -160,7 +160,9 @@ extension BaseGarminManager: IQUIOverrideDelegate {
                 "The app Garmin Connect must be installed to use for Trio.\n Go to App Store to download it",
                 comment: ""
             ),
-            type: .warning
+            type: .warning,
+            subtype: .misc,
+            title: NSLocalizedString("Garmin is not available", comment: "")
         )
         router.alertMessage.send(messageCont)
     }