Pārlūkot izejas kodu

Merge branch 'dnzxy:core-data-sync-trio' into glucoseNotificationsPicker

kskandis 1 gadu atpakaļ
vecāks
revīzija
39c4848cc6

+ 9 - 5
FreeAPS/Sources/Modules/Adjustments/AdjustmentsStateModel+Extensions/AdjustmentsStateModel+Overrides.swift

@@ -187,11 +187,15 @@ extension Adjustments.StateModel {
     /// Then unpack it on the view context and update the State variables which can be used on in the View for some Logic
     /// This also needs to be called when we cancel an Override via the Home View to update the State of the Button for this case
     func updateLatestOverrideConfiguration() {
-        Task {
-            let id = await overrideStorage.loadLatestOverrideConfigurations(fetchLimit: 1)
-            async let updateState: () = updateLatestOverrideConfigurationOfState(from: id)
-            async let setOverride: () = setCurrentOverride(from: id)
-            _ = await (updateState, setOverride)
+        Task { [weak self] in
+            guard let self = self else { return }
+            
+            let id = await self.overrideStorage.loadLatestOverrideConfigurations(fetchLimit: 1)
+            
+            // execute sequentially instead of concurrently
+            await self.updateLatestOverrideConfigurationOfState(from: id)
+            await self.setCurrentOverride(from: id)
+            
         }
     }
 

+ 5 - 2
FreeAPS/Sources/Modules/Home/HomeStateModel+Setup/GlucoseTargetSetup.swift

@@ -20,7 +20,7 @@ extension Home.StateModel {
 
         // Ensure there are targets to process
         guard !rawTargets.targets.isEmpty else {
-            print("Warning: No targets to process in rawTargets.")
+            debugPrint("\(DebuggingIdentifiers.failed) Warning: No targets to process in rawTargets.")
             return []
         }
 
@@ -37,7 +37,7 @@ extension Home.StateModel {
 
             // Validate target index to ensure safety
             guard targetIndex < targets.count else {
-                print("Error: Invalid target index \(targetIndex).")
+                debugPrint("\(DebuggingIdentifiers.failed) Error: Invalid target index \(targetIndex).")
                 continue
             }
 
@@ -78,6 +78,9 @@ extension Home.StateModel {
             )
         }
 
+        //TODO: - remove this after bug is fixed
+        debugPrint("\(DebuggingIdentifiers.inProgress) printing target profiles: \(targetProfiles)")
+        
         return targetProfiles
     }
 }

+ 17 - 15
FreeAPS/Sources/Modules/PumpConfig/View/PumpConfigRootView.swift

@@ -115,21 +115,23 @@ extension PumpConfig {
                 } message: { Text("Select Pump Model") }
             }
             .sheet(isPresented: $state.setupPump) {
-                if let pumpManager = state.provider.apsManager.pumpManager {
-                    PumpSettingsView(
-                        pumpManager: pumpManager,
-                        bluetoothManager: state.provider.apsManager.bluetoothManager!,
-                        completionDelegate: state,
-                        setupDelegate: state
-                    )
-                } else {
-                    PumpSetupView(
-                        pumpType: state.setupPumpType,
-                        pumpInitialSettings: state.initialSettings,
-                        bluetoothManager: state.provider.apsManager.bluetoothManager!,
-                        completionDelegate: state,
-                        setupDelegate: state
-                    )
+                NavigationView {
+                    if let pumpManager = state.provider.apsManager.pumpManager {
+                        PumpSettingsView(
+                            pumpManager: pumpManager,
+                            bluetoothManager: state.provider.apsManager.bluetoothManager!,
+                            completionDelegate: state,
+                            setupDelegate: state
+                        )
+                    } else {
+                        PumpSetupView(
+                            pumpType: state.setupPumpType,
+                            pumpInitialSettings: state.initialSettings,
+                            bluetoothManager: state.provider.apsManager.bluetoothManager!,
+                            completionDelegate: state,
+                            setupDelegate: state
+                        )
+                    }
                 }
             }
         }

+ 6 - 1
FreeAPS/Sources/Modules/PumpConfig/View/PumpSetupView.swift

@@ -87,7 +87,12 @@ extension PumpConfig {
             case let .createdAndOnboarded(pumpManagerUI):
                 debug(.default, "Pump manager  created and onboarded")
                 setupDelegate?.pumpManagerOnboarding(didCreatePumpManager: pumpManagerUI)
-                return UIViewController()
+                var vc = pumpManagerUI.settingsViewController(
+                    bluetoothProvider: bluetoothManager,
+                    pumpManagerOnboardingDelegate: setupDelegate
+                )
+                vc.completionDelegate = completionDelegate
+                return vc
             }
         }
 

+ 1 - 1
OmniBLE

@@ -1 +1 @@
-Subproject commit fee22b34644a6c349db92b55ce835114c377e4d7
+Subproject commit 1fa2874419225c8c7af0d9afbd9faf823cda34e5

+ 1 - 1
OmniKit

@@ -1 +1 @@
-Subproject commit 0857ad8d71d4d588ff7f5470e78fe8d6b5055924
+Subproject commit 48a35efa52f42e0b72fe2e984f60d4482a11a75f