Quellcode durchsuchen

Add icon and time range to profile label

Displays time range in label when SMBs are scheduled off in profile override.
For example, if the range is set from 22:00-6:00 it would display
⃠ 22-6
Mike Plante vor 2 Jahren
Ursprung
Commit
0336592d84
1 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen
  1. 8 2
      FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

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

@@ -243,7 +243,13 @@ extension Home {
                         ""
                         ""
                 )
                 )
 
 
-            let smbToggleString = (fetchedPercent.first?.smbIsOff ?? false) ? " \u{20e0}" : ""
+            let smbToggleString = (
+                (fetchedPercent.first?.smbIsOff ?? false) || fetchedPercent.first?.smbIsScheduledOff ?? false
+            ) ?
+                " \u{20e0}" : ""
+            let smbScheduleString = (fetchedPercent.first?.smbIsScheduledOff ?? false) &&
+                !(fetchedPercent.first?.smbIsOff ?? false) ?
+                " \(fetchedPercent.first?.start ?? 0)-\(fetchedPercent.first?.end ?? 0)" : ""
             var comma1 = ", "
             var comma1 = ", "
             var comma2 = comma1
             var comma2 = comma1
             var comma3 = comma1
             var comma3 = comma1
@@ -271,7 +277,7 @@ extension Home {
             if durationString == "", !indefinite {
             if durationString == "", !indefinite {
                 return nil
                 return nil
             }
             }
-            return percentString + comma1 + targetString + comma2 + durationString + comma3 + smbToggleString
+            return percentString + comma1 + targetString + comma2 + durationString + comma3 + smbToggleString + smbScheduleString
         }
         }
 
 
         var infoPanel: some View {
         var infoPanel: some View {