polscm32 aka Marvout 1 vuosi sitten
vanhempi
commit
8552faecd7
1 muutettua tiedostoa jossa 2 lisäystä ja 40 poistoa
  1. 2 40
      FreeAPS/Sources/Services/HealthKit/HealthKitManager.swift

+ 2 - 40
FreeAPS/Sources/Services/HealthKit/HealthKitManager.swift

@@ -434,6 +434,8 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsStoredDeleg
             }
         }
     }
+    
+    // Observer that notifies when new Glucose values arrive in Apple Health
 
     func createBGObserver() {
         guard settingsManager.settings.useAppleHealth else { return }
@@ -482,46 +484,6 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsStoredDeleg
         }
     }
 
-    /// Try to load samples from Health store
-    private func loadSamplesFromHealth(
-        sampleType: HKQuantityType,
-        limit: Int = 100,
-        completion: @escaping (_ samples: [HKSample]) -> Void
-    ) {
-        let query = HKSampleQuery(
-            sampleType: sampleType,
-            predicate: nil,
-            limit: limit,
-            sortDescriptors: nil
-        ) { _, results, _ in
-            completion(results as? [HKQuantitySample] ?? [])
-        }
-        healthKitStore.execute(query)
-    }
-
-    /// Try to load samples from Health store with id and do some work
-    private func loadSamplesFromHealth(
-        sampleType: HKQuantityType,
-        withIDs ids: [String],
-        limit: Int = 100,
-        completion: @escaping (_ samples: [HKSample]) -> Void
-    ) {
-        let predicate = HKQuery.predicateForObjects(
-            withMetadataKey: HKMetadataKeySyncIdentifier,
-            allowedValues: ids
-        )
-
-        let query = HKSampleQuery(
-            sampleType: sampleType,
-            predicate: predicate,
-            limit: limit,
-            sortDescriptors: nil
-        ) { _, results, _ in
-            completion(results as? [HKQuantitySample] ?? [])
-        }
-        healthKitStore.execute(query)
-    }
-
     private func getBloodGlucoseHKQuery(predicate: NSPredicate) -> HKQuery? {
         guard let sampleType = Config.healthBGObject else { return nil }