Parcourir la source

Merge branch 'core-data-sync-trio' of github.com:dnzxy/Trio-dev into watch

polscm32 aka Marvout il y a 1 an
Parent
commit
ebfe4e25ee

+ 1 - 1
OmniBLE

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

+ 1 - 1
OmniKit

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

+ 9 - 5
Trio/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
     /// 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
     /// 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() {
     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
Trio/Sources/Modules/Home/HomeStateModel+Setup/GlucoseTargetSetup.swift

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