Просмотр исходного кода

Fix glucoseSource assignment in FetchGlucoseManager

Deniz Cengiz 1 год назад
Родитель
Сommit
472e688380
1 измененных файлов с 3 добавлено и 13 удалено
  1. 3 13
      Trio/Sources/APS/FetchGlucoseManager.swift

+ 3 - 13
Trio/Sources/APS/FetchGlucoseManager.swift

@@ -149,7 +149,6 @@ final class BaseFetchGlucoseManager: FetchGlucoseManager, Injectable {
                 .store(in: &self.lifetime)
             }
             .store(in: &lifetime)
-//        debug(.deviceManager, "FetchGlucoseManager: timer.fire() and timer.resume() called")
         timer.fire()
         timer.resume()
     }
@@ -218,18 +217,9 @@ final class BaseFetchGlucoseManager: FetchGlucoseManager, Injectable {
 
         if let manager = newManager {
             debug(.deviceManager, "FetchGlucoseManager: New manager provided of type: \(type(of: manager))")
-            // If the pointer to manager is the *same* as our current `cgmManager`, skip re-init
-            if manager !== cgmManager {
-                debug(.deviceManager, "FetchGlucoseManager: New manager is different from current manager, reinitializing")
-                removeCalibrations()
-                cgmManager = manager
-                glucoseSource = nil
-            } else {
-                debug(
-                    .deviceManager,
-                    "FetchGlucoseManager: New manager is the same instance as current manager, skipping reinitialization"
-                )
-            }
+            removeCalibrations()
+            cgmManager = manager
+            glucoseSource = nil
         } else if self.cgmGlucoseSourceType == .plugin, cgmManager == nil, let rawCGMManager = rawCGMManager {
             debug(
                 .deviceManager,