소스 검색

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 년 전
부모
커밋
0336592d84
1개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  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 {