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

Fix for bug after commit f039dc3. Carbs not uploaded to Apple Health … …due to wrong id in func (#301)

* Fix for deletion of previous entered carbs when entering addcarbs view through add meal button in bolus view

* Fix for bug after commit f039dc3. Carbs not uploaded to Apple Health due to wrong id in func
dsnallfot 2 лет назад
Родитель
Сommit
f1d7bd7495
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      FreeAPS/Sources/Services/HealthKit/HealthKitManager.swift

+ 3 - 3
FreeAPS/Sources/Services/HealthKit/HealthKitManager.swift

@@ -186,7 +186,7 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsObserver, P
         else { return }
         else { return }
 
 
         let carbsWithId = carbs.filter { c in
         let carbsWithId = carbs.filter { c in
-            guard c.id != nil else { return false }
+            guard c.collectionID != nil else { return false }
             return true
             return true
         }
         }
 
 
@@ -203,8 +203,8 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsObserver, P
                         start: $0.createdAt,
                         start: $0.createdAt,
                         end: $0.createdAt,
                         end: $0.createdAt,
                         metadata: [
                         metadata: [
-                            HKMetadataKeyExternalUUID: $0.id ?? "_id",
-                            HKMetadataKeySyncIdentifier: $0.id ?? "_id",
+                            HKMetadataKeyExternalUUID: $0.collectionID ?? "_id",
+                            HKMetadataKeySyncIdentifier: $0.collectionID ?? "_id",
                             HKMetadataKeySyncVersion: 1,
                             HKMetadataKeySyncVersion: 1,
                             Config.freeAPSMetaKey: true
                             Config.freeAPSMetaKey: true
                         ]
                         ]