Jelajahi Sumber

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 2 tahun lalu
induk
melakukan
0336592d84
1 mengubah file dengan 8 tambahan dan 2 penghapusan
  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 comma2 = comma1
             var comma3 = comma1
@@ -271,7 +277,7 @@ extension Home {
             if durationString == "", !indefinite {
                 return nil
             }
-            return percentString + comma1 + targetString + comma2 + durationString + comma3 + smbToggleString
+            return percentString + comma1 + targetString + comma2 + durationString + comma3 + smbToggleString + smbScheduleString
         }
 
         var infoPanel: some View {