diff --git a/Config.xcconfig b/Config.xcconfig index fadc977848..70f525f78b 100644 --- a/Config.xcconfig +++ b/Config.xcconfig @@ -1,5 +1,5 @@ APP_DISPLAY_NAME = iAPS -APP_VERSION = 3.0.1 +APP_VERSION = 3.0.2 APP_BUILD_NUMBER = 1 COPYRIGHT_NOTICE = DEVELOPER_TEAM = ##TEAM_ID## diff --git a/Dependencies/G7SensorKit/G7SensorKitUI/sk.lproj/Localizable.strings b/Dependencies/G7SensorKit/G7SensorKitUI/sk.lproj/Localizable.strings index 1d28827006..fb10596224 100644 --- a/Dependencies/G7SensorKit/G7SensorKitUI/sk.lproj/Localizable.strings +++ b/Dependencies/G7SensorKit/G7SensorKitUI/sk.lproj/Localizable.strings @@ -68,6 +68,9 @@ /* No comment provided by engineer. */ "Scan for new sensor" = "Načítať nový senzor"; +/* No comment provided by engineer. */ +"Scan for new sensor" = "Načítať nový senzor"; + /* title for g7 settings connection status when scanning */ "Scanning" = "Skenuje sa"; diff --git a/Dependencies/OmniBLE/Localizations/ar.lproj/Localizable.strings b/Dependencies/OmniBLE/Localizations/ar.lproj/Localizable.strings index 41a3531ef0..6b55134c44 100644 --- a/Dependencies/OmniBLE/Localizations/ar.lproj/Localizable.strings +++ b/Dependencies/OmniBLE/Localizations/ar.lproj/Localizable.strings @@ -447,6 +447,9 @@ /* Label text for step 1 of pair pod instructions */ "Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; +/* Label text for step 1 of pair pod instructions */ +"Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; + /* Label text for step 2 of pair pod instructions */ "Listen for 2 beeps." = "Listen for 2 beeps."; diff --git a/Dependencies/OmniBLE/Localizations/da.lproj/Localizable.strings b/Dependencies/OmniBLE/Localizations/da.lproj/Localizable.strings index dfc2b15393..5317dc4e5f 100644 --- a/Dependencies/OmniBLE/Localizations/da.lproj/Localizable.strings +++ b/Dependencies/OmniBLE/Localizations/da.lproj/Localizable.strings @@ -444,6 +444,9 @@ /* Label text for step 1 of pair pod instructions */ "Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; +/* Label text for step 1 of pair pod instructions */ +"Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; + /* Label text for step 2 of pair pod instructions */ "Listen for 2 beeps." = "Lyt efter 2 bip."; diff --git a/Dependencies/OmniBLE/Localizations/en.lproj/Localizable.strings b/Dependencies/OmniBLE/Localizations/en.lproj/Localizable.strings index 3a86c62721..22ff16086c 100644 --- a/Dependencies/OmniBLE/Localizations/en.lproj/Localizable.strings +++ b/Dependencies/OmniBLE/Localizations/en.lproj/Localizable.strings @@ -449,6 +449,9 @@ /* Label text for step 1 of pair pod instructions */ "Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; +/* Label text for step 1 of pair pod instructions */ +"Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; + /* Label text for step 2 of pair pod instructions */ "Listen for 2 beeps." = "Listen for 2 beeps."; diff --git a/Dependencies/OmniBLE/Localizations/es.lproj/Localizable.strings b/Dependencies/OmniBLE/Localizations/es.lproj/Localizable.strings index 7a083ee138..bc71c1adfe 100644 --- a/Dependencies/OmniBLE/Localizations/es.lproj/Localizable.strings +++ b/Dependencies/OmniBLE/Localizations/es.lproj/Localizable.strings @@ -447,6 +447,9 @@ /* Label text for step 1 of pair pod instructions */ "Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; +/* Label text for step 1 of pair pod instructions */ +"Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; + /* Label text for step 2 of pair pod instructions */ "Listen for 2 beeps." = "Listen for 2 beeps."; diff --git a/Dependencies/OmniBLE/Localizations/fi.lproj/Localizable.strings b/Dependencies/OmniBLE/Localizations/fi.lproj/Localizable.strings index 0d74e8ccf8..d01c77d760 100644 --- a/Dependencies/OmniBLE/Localizations/fi.lproj/Localizable.strings +++ b/Dependencies/OmniBLE/Localizations/fi.lproj/Localizable.strings @@ -447,6 +447,9 @@ /* Label text for step 1 of pair pod instructions */ "Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; +/* Label text for step 1 of pair pod instructions */ +"Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; + /* Label text for step 2 of pair pod instructions */ "Listen for 2 beeps." = "Listen for 2 beeps."; diff --git a/Dependencies/OmniBLE/Localizations/fr.lproj/Localizable.strings b/Dependencies/OmniBLE/Localizations/fr.lproj/Localizable.strings index 76548b833e..88db58ba2b 100644 --- a/Dependencies/OmniBLE/Localizations/fr.lproj/Localizable.strings +++ b/Dependencies/OmniBLE/Localizations/fr.lproj/Localizable.strings @@ -447,6 +447,9 @@ /* Label text for step 1 of pair pod instructions */ "Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; +/* Label text for step 1 of pair pod instructions */ +"Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; + /* Label text for step 2 of pair pod instructions */ "Listen for 2 beeps." = "Écoutez deux bips."; diff --git a/Dependencies/OmniBLE/Localizations/he.lproj/Localizable.strings b/Dependencies/OmniBLE/Localizations/he.lproj/Localizable.strings index 41a3531ef0..6b55134c44 100644 --- a/Dependencies/OmniBLE/Localizations/he.lproj/Localizable.strings +++ b/Dependencies/OmniBLE/Localizations/he.lproj/Localizable.strings @@ -447,6 +447,9 @@ /* Label text for step 1 of pair pod instructions */ "Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; +/* Label text for step 1 of pair pod instructions */ +"Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; + /* Label text for step 2 of pair pod instructions */ "Listen for 2 beeps." = "Listen for 2 beeps."; diff --git a/Dependencies/OmniBLE/Localizations/pl.lproj/Localizable.strings b/Dependencies/OmniBLE/Localizations/pl.lproj/Localizable.strings index a98d502a15..8d1ec77339 100644 --- a/Dependencies/OmniBLE/Localizations/pl.lproj/Localizable.strings +++ b/Dependencies/OmniBLE/Localizations/pl.lproj/Localizable.strings @@ -447,6 +447,9 @@ /* Label text for step 1 of pair pod instructions */ "Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; +/* Label text for step 1 of pair pod instructions */ +"Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; + /* Label text for step 2 of pair pod instructions */ "Listen for 2 beeps." = "Listen for 2 beeps."; diff --git a/Dependencies/OmniBLE/Localizations/pt-BR.lproj/Localizable.strings b/Dependencies/OmniBLE/Localizations/pt-BR.lproj/Localizable.strings index d27c00c2fe..9cf6f4bf97 100644 --- a/Dependencies/OmniBLE/Localizations/pt-BR.lproj/Localizable.strings +++ b/Dependencies/OmniBLE/Localizations/pt-BR.lproj/Localizable.strings @@ -447,6 +447,9 @@ /* Label text for step 1 of pair pod instructions */ "Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; +/* Label text for step 1 of pair pod instructions */ +"Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; + /* Label text for step 2 of pair pod instructions */ "Listen for 2 beeps." = "Listen for 2 beeps."; diff --git a/Dependencies/OmniBLE/Localizations/pt-PT.lproj/Localizable.strings b/Dependencies/OmniBLE/Localizations/pt-PT.lproj/Localizable.strings index 6ec532d1ac..ccc1346a92 100644 --- a/Dependencies/OmniBLE/Localizations/pt-PT.lproj/Localizable.strings +++ b/Dependencies/OmniBLE/Localizations/pt-PT.lproj/Localizable.strings @@ -447,6 +447,9 @@ /* Label text for step 1 of pair pod instructions */ "Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; +/* Label text for step 1 of pair pod instructions */ +"Remove the Pod's blue needle cap and check cannula. Then remove paper backing." = "Remove the Pod's blue needle cap and check cannula. Then remove paper backing."; + /* Label text for step 2 of pair pod instructions */ "Listen for 2 beeps." = "Listen for 2 beeps."; diff --git a/Dependencies/OmniBLE/Localizations/uk.lproj/Localizable.strings b/Dependencies/OmniBLE/Localizations/uk.lproj/Localizable.strings index 0e1dcea944..59e5763079 100644 --- a/Dependencies/OmniBLE/Localizations/uk.lproj/Localizable.strings +++ b/Dependencies/OmniBLE/Localizations/uk.lproj/Localizable.strings @@ -616,10 +616,6 @@ /* Description for BeepPreference.extended */ "Confidence reminders will sound when the app automatically adjusts delivery as well as for commands you initiate." = "Нагадування про довіру лунатимуть, коли Loop автоматично регулює доставку, а також для команд, які ви ініціюєте."; -/* Description for BeepPreference.extended */ -"Confidence reminders will sound when the app automatically adjusts delivery as well as for commands you initiate." = "Нагадування про довіру лунатимуть, коли Loop автоматично регулює доставку, а також для команд, які ви ініціюєте."; ->>>>>>> 7f4d47c8 (Crowdin (#334)) - /* Label text for temporary basal rate summary */ "Rate" = "Швидкість"; diff --git a/Dependencies/OmniKit/OmniKit/Resources/ru.lproj/Localizable.strings b/Dependencies/OmniKit/OmniKit/Resources/ru.lproj/Localizable.strings index 07866cf7ff..5188e016fb 100644 --- a/Dependencies/OmniKit/OmniKit/Resources/ru.lproj/Localizable.strings +++ b/Dependencies/OmniKit/OmniKit/Resources/ru.lproj/Localizable.strings @@ -68,10 +68,6 @@ /* Description for BeepPreference.extended */ "Confidence reminders will sound when the app automatically adjusts delivery as well as for commands you initiate." = "Доверенные звуковые сигналы сработают даже тогда, когда петля автоматически изменит подачу инсулина, а также для команд, которые Вы инициируете."; -/* Description for BeepPreference.extended */ -"Confidence reminders will sound when the app automatically adjusts delivery as well as for commands you initiate." = "Доверенные звуковые сигналы сработают даже тогда, когда петля автоматически изменит подачу инсулина, а также для команд, которые Вы инициируете."; ->>>>>>> 420dc4ed (Crowdin (#362)) - /* The title for AlarmCode.other notification */ "Critical Pod Error" = "Критическая ошибка пода"; diff --git a/Dependencies/OmniKit/OmniKit/Resources/uk.lproj/Localizable.strings b/Dependencies/OmniKit/OmniKit/Resources/uk.lproj/Localizable.strings index bece69afee..48c06a44c2 100644 --- a/Dependencies/OmniKit/OmniKit/Resources/uk.lproj/Localizable.strings +++ b/Dependencies/OmniKit/OmniKit/Resources/uk.lproj/Localizable.strings @@ -68,10 +68,6 @@ /* Description for BeepPreference.extended */ "Confidence reminders will sound when the app automatically adjusts delivery as well as for commands you initiate." = "Нагадування про довіру лунатимуть, коли Loop автоматично регулює доставку, а також для команд, які ви ініціюєте."; -/* Description for BeepPreference.extended */ -"Confidence reminders will sound when the app automatically adjusts delivery as well as for commands you initiate." = "Нагадування про довіру лунатимуть, коли Loop автоматично регулює доставку, а також для команд, які ви ініціюєте."; ->>>>>>> 7f4d47c8 (Crowdin (#334)) - /* The title for AlarmCode.other notification */ "Critical Pod Error" = "Критична Помилка"; diff --git a/Dependencies/OmniKit/OmniKitUI/Resources/uk.lproj/Localizable.strings b/Dependencies/OmniKit/OmniKitUI/Resources/uk.lproj/Localizable.strings index 364c4841dd..03d58e64a7 100644 --- a/Dependencies/OmniKit/OmniKitUI/Resources/uk.lproj/Localizable.strings +++ b/Dependencies/OmniKit/OmniKitUI/Resources/uk.lproj/Localizable.strings @@ -776,11 +776,6 @@ /* Alert message body for confirm pod attachment */ "Your Pod may still be delivering Insulin.\nRemove it from your body, then tap “Continue.“" = "Ваш Pod може все ще подавати інсулін.\nЗніміть його зі свого тіла, а потім натисніть «Продовжити»"; -<<<<<<< HEAD -<<<<<<< HEAD -======= -======= ->>>>>>> Crowdin /* Title string for SilencePodPreference.enabled */ "Silenced" = "Сповіщення вимкнено"; diff --git a/FreeAPS/Sources/Localizations/Main/tr.lproj/Localizable.strings b/FreeAPS/Sources/Localizations/Main/tr.lproj/Localizable.strings index d0a85e196d..cc89fbb7c1 100644 --- a/FreeAPS/Sources/Localizations/Main/tr.lproj/Localizable.strings +++ b/FreeAPS/Sources/Localizations/Main/tr.lproj/Localizable.strings @@ -587,10 +587,6 @@ Enact a temp Basal or a temp target */ /* Delete insulin from pump history and Nightscout */ "Delete Insulin?" = "Delete Insulin?"; -/* Delete insulin from pump history and Nightscout */ -"Delete Insulin?" = "Delete Insulin?"; ->>>>>>> Crowdin - /* Treatments list */ "Treatments" = "Tedaviler"; diff --git a/FreeAPS/Sources/Services/HealthKit/HealthKitManager.swift b/FreeAPS/Sources/Services/HealthKit/HealthKitManager.swift index fef08e73c9..fbd2d35595 100644 --- a/FreeAPS/Sources/Services/HealthKit/HealthKitManager.swift +++ b/FreeAPS/Sources/Services/HealthKit/HealthKitManager.swift @@ -234,23 +234,24 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsObserver, P events.isNotEmpty else { return } - func save(bolusToModify: [InsulinBolus], bolus: [InsulinBolus], basal: [InsulinBasal]) { - // first step : delete the HK value - // second step : recreate with the new value ! - bolusToModify.forEach { syncID in + func delete(syncIds: [String]?) { + syncIds?.forEach { syncID in let predicate = HKQuery.predicateForObjects( withMetadataKey: HKMetadataKeySyncIdentifier, operatorType: .equalTo, value: syncID ) + self.healthKitStore.deleteObjects(of: sampleType, predicate: predicate) { _, _, error in if let error = error { warning(.service, "Cannot delete sample with syncID: \(syncID)", error: error) } } } - let bolusTotal = bolus + bolusToModify - let bolusSamples = bolusTotal + } + + func save(bolus: [InsulinBolus], basal: [InsulinBasal]) { + let bolusSamples = bolus .map { HKQuantitySample( type: sampleType, @@ -290,22 +291,30 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsObserver, P } } } - + // delete existing event in HK where the amount is not the last value in the pumphistory loadSamplesFromHealth(sampleType: sampleType, withIDs: events.map(\.id)) .receive(on: processQueue) - .compactMap { samples -> ([InsulinBolus], [InsulinBolus], [InsulinBasal]) in + .compactMap { samples -> [String] in let sampleIDs = samples.compactMap(\.syncIdentifier) - let bolusToModify = events + let bolusToDelete = events .filter { $0.type == .bolus && sampleIDs.contains($0.id) } - .compactMap { event -> InsulinBolus? in + .compactMap { event -> String? in guard let amount = event.amount else { return nil } guard let sampleAmount = samples.first(where: { $0.syncIdentifier == event.id }) as? HKQuantitySample else { return nil } if Double(amount) != sampleAmount.quantity.doubleValue(for: .internationalUnit()) { - return InsulinBolus(id: sampleAmount.syncIdentifier!, amount: amount, date: event.timestamp) + return sampleAmount.syncIdentifier } else { return nil } } + return bolusToDelete + } + .sink(receiveValue: delete) + .store(in: &lifetime) + loadSamplesFromHealth(sampleType: sampleType, withIDs: events.map(\.id)) + .receive(on: processQueue) + .compactMap { samples -> ([InsulinBolus], [InsulinBasal]) in + let sampleIDs = samples.compactMap(\.syncIdentifier) let bolus = events .filter { $0.type == .bolus && !sampleIDs.contains($0.id) } .compactMap { event -> InsulinBolus? in @@ -350,7 +359,7 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsObserver, P endDelivery: nextBasalEvent.timestamp ) } - return (bolusToModify, bolus, basal) + return (bolus, basal) } .sink(receiveValue: save) .store(in: &lifetime) @@ -409,14 +418,13 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsObserver, P /// Try to load samples from Health store private func loadSamplesFromHealth( - sampleType: HKQuantityType, - limit: Int = 100 + sampleType: HKQuantityType ) -> Future<[HKSample], Never> { Future { promise in let query = HKSampleQuery( sampleType: sampleType, predicate: nil, - limit: limit, + limit: 100, sortDescriptors: nil ) { _, results, _ in promise(.success((results as? [HKQuantitySample]) ?? [])) @@ -428,8 +436,7 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsObserver, P /// Try to load samples from Health store with id and do some work private func loadSamplesFromHealth( sampleType: HKQuantityType, - withIDs ids: [String], - limit: Int = 100 + withIDs ids: [String] ) -> Future<[HKSample], Never> { Future { promise in let predicate = HKQuery.predicateForObjects( @@ -440,7 +447,7 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsObserver, P let query = HKSampleQuery( sampleType: sampleType, predicate: predicate, - limit: limit, + limit: 100, sortDescriptors: nil ) { _, results, _ in promise(.success((results as? [HKQuantitySample]) ?? []))