瀏覽代碼

add notify function for basal profile

polscm32 aka Marvout 1 年之前
父節點
當前提交
cfb3811f79
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      FreeAPS/Sources/Modules/BasalProfileEditor/BasalProfileEditorStateModel.swift

+ 7 - 0
FreeAPS/Sources/Modules/BasalProfileEditor/BasalProfileEditorStateModel.swift

@@ -4,6 +4,7 @@ import SwiftUI
 extension BasalProfileEditor {
 extension BasalProfileEditor {
     @Observable final class StateModel: BaseStateModel<Provider> {
     @Observable final class StateModel: BaseStateModel<Provider> {
         @ObservationIgnored @Injected() private var nightscout: NightscoutManager!
         @ObservationIgnored @Injected() private var nightscout: NightscoutManager!
+        @ObservationIgnored @Injected() private var broadcaster: Broadcaster!
 
 
         var syncInProgress: Bool = false
         var syncInProgress: Bool = false
         var initialItems: [Item] = []
         var initialItems: [Item] = []
@@ -105,6 +106,12 @@ extension BasalProfileEditor {
                     print("We were successful")
                     print("We were successful")
                 }
                 }
                 .store(in: &lifetime)
                 .store(in: &lifetime)
+
+            DispatchQueue.main.async {
+                self.broadcaster.notify(BasalProfileObserver.self, on: .main) {
+                    $0.basalProfileDidChange(profile)
+                }
+            }
         }
         }
 
 
         @MainActor func validate() {
         @MainActor func validate() {