فهرست منبع

Fix target offset, revert to old time label in Live Activity

polscm32 aka Marvout 1 سال پیش
والد
کامیت
027f48612d

+ 2 - 2
FreeAPS/Sources/Modules/LiveActivitySettings/View/LiveActivityWidgetConfiguration.swift

@@ -256,7 +256,7 @@ struct LiveActivityWidgetConfiguration: BaseView {
                 }
                 .disabled(selectedItems.contains(item))
                 // This causes the type check error
-                
+
 //                .disabled(selectedItems.contains { $0.value == item }) // Disable already selected items
             }
         }
@@ -268,7 +268,7 @@ struct LiveActivityWidgetConfiguration: BaseView {
             showAddItemDialog.toggle()
         }) {
             // This causes an index out of range error
-            
+
 //            if let selectedItem = LiveActivityItem.allCases.first(where: { $0.id == selectedItems[index].id }) {
 //                // Show item preview if an item is selected
 //                getItemPreview(for: selectedItem)

+ 3 - 4
LiveActivity/LiveActivity.swift

@@ -74,8 +74,8 @@ extension Color {
         offset: Decimal
     ) -> Color {
         // Convert Decimal to Int for high and low glucose values
-        let lowGlucose = lowGlucoseColorValue - offset
-        let highGlucose = highGlucoseColorValue + (offset * 1.75)
+        let lowGlucose = glucoseColorScheme == "dynamicColor" ? (lowGlucoseColorValue - offset) : lowGlucoseColorValue
+        let highGlucose = glucoseColorScheme == "dynamicColor" ? (highGlucoseColorValue + (offset * 1.75)) : highGlucoseColorValue
         let targetGlucose = targetGlucose
 
         // Only use calculateHueBasedGlucoseColor if the setting is enabled in preferences
@@ -388,8 +388,7 @@ struct LiveActivityUpdatedLabelView: View {
 
     var body: some View {
         if isDetailedLayout {
-            let minutesAgo = Int(Date().timeIntervalSince(context.state.date) / 60)
-            let dateText = Text("\(minutesAgo < 1 ? "<1" : minutesAgo.description)m ago").font(.title3)
+            let dateText = Text("\(dateFormatter.string(from: context.state.date))").font(.title3)
                 .foregroundStyle(.primary)
 
             VStack {