From 67b7aaa8e7b547dd1942f32d90059cb72c7594ed Mon Sep 17 00:00:00 2001 From: Paul Plant <37302780+paulplant@users.noreply.github.com> Date: Tue, 15 Oct 2024 11:58:15 +0200 Subject: [PATCH 1/5] Xcode16 compiler warning fix without needing @retroactive - and therefore without breaking Xcode15 builds. --- xdrip/Extensions/ChartPoint.swift | 2 +- xdrip/Extensions/Double.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xdrip/Extensions/ChartPoint.swift b/xdrip/Extensions/ChartPoint.swift index eecf886cc..2aa9d05b8 100644 --- a/xdrip/Extensions/ChartPoint.swift +++ b/xdrip/Extensions/ChartPoint.swift @@ -62,7 +62,7 @@ extension ChartPoint { } -extension ChartPoint: Comparable { +extension SwiftCharts.ChartPoint: Swift.Comparable { public static func < (lhs: ChartPoint, rhs: ChartPoint) -> Bool { diff --git a/xdrip/Extensions/Double.swift b/xdrip/Extensions/Double.swift index 06e27129b..ac7f8a5b6 100644 --- a/xdrip/Extensions/Double.swift +++ b/xdrip/Extensions/Double.swift @@ -1,6 +1,6 @@ import Foundation -extension Double: RawRepresentable { +extension Swift.Double: Swift.RawRepresentable { //MARK: - copied from https://github.com/LoopKit/LoopKit From 8e776f4da56790c7d5c2b781bbe5a66928e6a917 Mon Sep 17 00:00:00 2001 From: Paul Plant <37302780+paulplant@users.noreply.github.com> Date: Tue, 15 Oct 2024 12:26:17 +0200 Subject: [PATCH 2/5] FR translations added for Algorithm + Calibration Types and a small one for Swedish :) --- xdrip/Storyboards/fr.lproj/BluetoothPeripheralView.strings | 4 ++++ xdrip/Storyboards/sv.lproj/BluetoothPeripheralView.strings | 1 + 2 files changed, 5 insertions(+) diff --git a/xdrip/Storyboards/fr.lproj/BluetoothPeripheralView.strings b/xdrip/Storyboards/fr.lproj/BluetoothPeripheralView.strings index 04c8b79b5..56213a1b6 100644 --- a/xdrip/Storyboards/fr.lproj/BluetoothPeripheralView.strings +++ b/xdrip/Storyboards/fr.lproj/BluetoothPeripheralView.strings @@ -73,3 +73,7 @@ "nativeAlgorithm" = "Algorithme natif"; "xDripAlgorithm" = "Algorithme xDrip"; +"confirmAlgorithmChangeToTransmitterMessage" = "Confirmer le changement pour revenir à l'algorithme natif/transmetteur"; +"confirmAlgorithmChangeToxDripMessage" = "Confirmer le changement pour utiliser l'algorithme xDrip.\n\nLes lectures vont s'interrompre un moment et vous devrez insérer une valeur de calibration initiale."; +"confirmCalibrationChangeToSinglePointMessage" = "Confirmer le changement du type de calibration à standard\n\nLes lectures vont s'interrompre un moment et vous devrez insérer une valeur de calibration initiale."; +"confirmCalibrationChangeToMultiPointMessage" = "Confirmer le changement du type de calibration à multipoints\n\n⚠️ Notez que cette méthode est réservée aux utilisateurs expérimentés car elle peut générer des résultats dangereux en cas de calibration incorrecte.\n\nSi vous n'êtes pas sûr de savoir l'utiliser, sélectionnez Annuler."; diff --git a/xdrip/Storyboards/sv.lproj/BluetoothPeripheralView.strings b/xdrip/Storyboards/sv.lproj/BluetoothPeripheralView.strings index 75b09405b..3b53dea8f 100644 --- a/xdrip/Storyboards/sv.lproj/BluetoothPeripheralView.strings +++ b/xdrip/Storyboards/sv.lproj/BluetoothPeripheralView.strings @@ -76,3 +76,4 @@ "confirmAlgorithmChangeToxDripMessage" = "Bekräfta att du vill ändra till xDrip-algoritmen.\n\nDetta stoppar avläsningarna under en kort tid och du kommer få ange ett initialt kalibreringsvärde."; "confirmCalibrationChangeToSinglePointMessage" = "Bekräfta att du vill ändra kalibreringstypen till Standardkalibrering\n\nDetta stoppar avläsningarna under en kort tid och du kommer få ange ett initialt kalibreringsvärde."; "confirmCalibrationChangeToMultiPointMessage" = "Bekräfta att du vill ändra kalibreringstypen till Flerpunktskalibrering\n\n⚠️ Observera att denna metod endast är för avancerade användare och kan potentiellt ge farliga resultat om kalibreringen inte är korrekt utförd.\n\n Om du är osäker på hur man använder denna metod, vänligen tryck på avbryt."; +"confirm" = "Bekräfta"; From 7d63c3053d9ed7a1028a5e184c2eafdd23d8a4ba Mon Sep 17 00:00:00 2001 From: Paul Plant <37302780+paulplant@users.noreply.github.com> Date: Sat, 19 Oct 2024 00:49:16 +0200 Subject: [PATCH 3/5] Dexcom Stelo implementation --- .../Generic/BluetoothPeripheralType.swift | 5 ++-- .../CGM/Dexcom/G7/CGMG7Transmitter.swift | 26 ++++++++++++------- .../CGM/Generic/CGMTransmitter.swift | 6 +++-- xdrip/Constants/ConstantsDexcomG7.swift | 3 +++ ...DexcomG7BluetoothPeripheralViewModel.swift | 2 +- ...eartBeatBluetoothPeripheralViewModel.swift | 2 +- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/xdrip/BluetoothPeripheral/Generic/BluetoothPeripheralType.swift b/xdrip/BluetoothPeripheral/Generic/BluetoothPeripheralType.swift index 0a09a4f47..4f04d880a 100644 --- a/xdrip/BluetoothPeripheral/Generic/BluetoothPeripheralType.swift +++ b/xdrip/BluetoothPeripheral/Generic/BluetoothPeripheralType.swift @@ -26,7 +26,7 @@ enum BluetoothPeripheralType: String, CaseIterable { case DexcomType = "Dexcom G5 / G6 / ONE" /// Dexcom G7 - case DexcomG7Type = "Dexcom G7 / ONE+" + case DexcomG7Type = "Dexcom G7 / ONE+ / Stelo" /// DexcomG4 case DexcomG4Type = "Dexcom G4 (Bridge)" @@ -53,8 +53,7 @@ enum BluetoothPeripheralType: String, CaseIterable { case Libre3HeartBeatType = "Libre/Generic HeartBeat" /// DexcomG7 heartbeat - case DexcomG7HeartBeatType = "Dexcom G7/ONE+ HeartBeat" - + case DexcomG7HeartBeatType = "Dexcom G7/ONE+/Stelo HeartBeat" /// omnipod heartbeat case OmniPodHeartBeatType = "OmniPod HeartBeat" diff --git a/xdrip/BluetoothTransmitter/CGM/Dexcom/G7/CGMG7Transmitter.swift b/xdrip/BluetoothTransmitter/CGM/Dexcom/G7/CGMG7Transmitter.swift index b682342ed..c0c1c9e04 100644 --- a/xdrip/BluetoothTransmitter/CGM/Dexcom/G7/CGMG7Transmitter.swift +++ b/xdrip/BluetoothTransmitter/CGM/Dexcom/G7/CGMG7Transmitter.swift @@ -4,7 +4,7 @@ import os class CGMG7Transmitter: BluetoothTransmitter, CGMTransmitter { - /// is the transmitter oop web enabled or not. For G7/ONE+ this must be set to true to use only the transmitter algorithm + /// is the transmitter oop web enabled or not. For G7/ONE+/Stelo this must be set to true to use only the transmitter algorithm private var webOOPEnabled: Bool /// stored when receiving single reading, needed when receiving backfill data @@ -112,7 +112,7 @@ class CGMG7Transmitter: BluetoothTransmitter, CGMTransmitter { init(address:String?, name: String?, bluetoothTransmitterDelegate: BluetoothTransmitterDelegate, cGMG7TransmitterDelegate: CGMG7TransmitterDelegate, cGMTransmitterDelegate:CGMTransmitterDelegate) { // assign addressname and name or expected devicename - // For G7/ONE+ we don't listen for a specific device name. Dexcom uses an advertising id, which already filters out all other devices (like tv's etc. We will verify in another way that we have the current active G7/ONE+, and not an old one, which is still near + // For G7/ONE+/Stelo we don't listen for a specific device name. Dexcom uses an advertising id, which already filters out all other devices (like tv's etc. We will verify in another way that we have the current active G7/ONE+/Stelo, and not an old one, which is still near var newAddressAndName: BluetoothTransmitter.DeviceAddressAndName = BluetoothTransmitter.DeviceAddressAndName.notYetConnected(expectedName: "DX") if let name = name { @@ -210,10 +210,16 @@ class CGMG7Transmitter: BluetoothTransmitter, CGMTransmitter { return } - let maxSensorAgeInDays = ConstantsDexcomG7.maxSensorAgeInDays + var maxSensorAgeInDays = ConstantsDexcomG7.maxSensorAgeInDays + + // check if it's a Stelo and if so, update the maxSensorAge + if let transmitterIdString = UserDefaults.standard.activeSensorTransmitterId, transmitterIdString.startsWith("DX01") { + maxSensorAgeInDays = ConstantsDexcomG7.maxSensorAgeInDaysStelo + } + let sensorAgeInDays = Double(round((g7GlucoseMessage.sensorAge / 3600 / 24) * 10) / 10) - // G7/ONE+ has the peculiarity that it will keep sending/repeating the same BG value (without ever changing) via BLE even after the session officially ends. + // G7/ONE+/Stelo has the peculiarity that it will keep sending/repeating the same BG value (without ever changing) via BLE even after the session officially ends. // to avoid this, let's check if the sensor is still within maxSensorAge before we continue guard sensorAgeInDays < maxSensorAgeInDays else { trace(" G7 is expired so will not process reading. sensorAge: %{public}@ / maxSensorAgeInDays: %{public}@", log: log, category: ConstantsLog.categoryCGMG7, type: .error, sensorAgeInDays.description, maxSensorAgeInDays.description) @@ -285,7 +291,7 @@ class CGMG7Transmitter: BluetoothTransmitter, CGMTransmitter { } else { - trace("Connected to Dexcom G7 that is not paired and/or authenticated by other app. Will disconnect and scan for another Dexcom G7", log: log, category: ConstantsLog.categoryCGMG7, type: .info ) + trace("Connected to Dexcom G7 that is not paired and/or authenticated by other app. Will disconnect and scan for another Dexcom G7/ONE+/Stelo", log: log, category: ConstantsLog.categoryCGMG7, type: .info ) disconnectAndForget() @@ -370,9 +376,11 @@ class CGMG7Transmitter: BluetoothTransmitter, CGMTransmitter { func maxSensorAgeInDays() -> Double? { - - return ConstantsDexcomG7.maxSensorAgeInDays - + if let transmitterIdString = UserDefaults.standard.activeSensorTransmitterId, transmitterIdString.startsWith("DX01") { + return ConstantsDexcomG7.maxSensorAgeInDaysStelo + } else { + return ConstantsDexcomG7.maxSensorAgeInDays + } } func getCBUUID_Service() -> String { @@ -392,7 +400,7 @@ class CGMG7Transmitter: BluetoothTransmitter, CGMTransmitter { // MARK: - private functions @objc private func authenticationFailed() { - trace("Connected to Dexcom G7 but authentication not received. Will disconnect and scan for another Dexcom G7", log: log, category: ConstantsLog.categoryCGMG7, type: .info ) + trace("Connected to Dexcom G7 but authentication not received. Will disconnect and scan for another Dexcom G7/ONE+/Stelo", log: log, category: ConstantsLog.categoryCGMG7, type: .info ) disconnectAndForget() diff --git a/xdrip/BluetoothTransmitter/CGM/Generic/CGMTransmitter.swift b/xdrip/BluetoothTransmitter/CGM/Generic/CGMTransmitter.swift index 81e63da29..13d7f7b58 100644 --- a/xdrip/BluetoothTransmitter/CGM/Generic/CGMTransmitter.swift +++ b/xdrip/BluetoothTransmitter/CGM/Generic/CGMTransmitter.swift @@ -85,7 +85,7 @@ enum CGMTransmitterType:String, CaseIterable { case dexcom = "Dexcom G5/G6/ONE" /// dexcom G7 - case dexcomG7 = "Dexcom G7/ONE+" + case dexcomG7 = "Dexcom G7/ONE+/Stelo" /// miaomiao case miaomiao = "MiaoMiao" @@ -312,7 +312,9 @@ enum CGMTransmitterType:String, CaseIterable { case .dexcomG7: if let transmitterIdString = UserDefaults.standard.activeSensorTransmitterId { - if transmitterIdString.startsWith("DX02") { + if transmitterIdString.startsWith("DX01") { + return "Dexcom Stelo" + } else if transmitterIdString.startsWith("DX02") { return "Dexcom ONE+" } } diff --git a/xdrip/Constants/ConstantsDexcomG7.swift b/xdrip/Constants/ConstantsDexcomG7.swift index e2e0f6566..9f9e02bff 100644 --- a/xdrip/Constants/ConstantsDexcomG7.swift +++ b/xdrip/Constants/ConstantsDexcomG7.swift @@ -14,4 +14,7 @@ enum ConstantsDexcomG7 { /// how many days the sensor session lasts. In the case of G7/ONE+ it is 10 days + a 12 hour grace period = 10.5 days static let maxSensorAgeInDays: Double = 10.5 + /// how many days the sensor session lasts. In the case of Stelo it is 15 days + a 12 hour grace period = 15.5 days + static let maxSensorAgeInDaysStelo: Double = 15.5 + } diff --git a/xdrip/View Controllers/BluetoothPeripheralsNavigationController/BluetoothPeripheralsViewController/BluetoothPeripheralViewController/Models/CGM/Dexcom/DexcomG7/DexcomG7BluetoothPeripheralViewModel.swift b/xdrip/View Controllers/BluetoothPeripheralsNavigationController/BluetoothPeripheralsViewController/BluetoothPeripheralViewController/Models/CGM/Dexcom/DexcomG7/DexcomG7BluetoothPeripheralViewModel.swift index 42656ae92..b844a6cc0 100644 --- a/xdrip/View Controllers/BluetoothPeripheralsNavigationController/BluetoothPeripheralsViewController/BluetoothPeripheralViewController/Models/CGM/Dexcom/DexcomG7/DexcomG7BluetoothPeripheralViewModel.swift +++ b/xdrip/View Controllers/BluetoothPeripheralsNavigationController/BluetoothPeripheralsViewController/BluetoothPeripheralViewController/Models/CGM/Dexcom/DexcomG7/DexcomG7BluetoothPeripheralViewModel.swift @@ -87,7 +87,7 @@ extension DexcomG7BluetoothPeripheralViewModel: BluetoothPeripheralViewModel { } func sectionTitle(forSection section: Int) -> String { - return "Dexcom G7 / ONE+" + return "Dexcom G7 / ONE+ / Stelo" } func update(cell: UITableViewCell, forRow rawValue: Int, forSection section: Int, for bluetoothPeripheral: BluetoothPeripheral) { diff --git a/xdrip/View Controllers/BluetoothPeripheralsNavigationController/BluetoothPeripheralsViewController/BluetoothPeripheralViewController/Models/HeartBeat/DexcomG7HeartBeatBluetoothPeripheralViewModel.swift b/xdrip/View Controllers/BluetoothPeripheralsNavigationController/BluetoothPeripheralsViewController/BluetoothPeripheralViewController/Models/HeartBeat/DexcomG7HeartBeatBluetoothPeripheralViewModel.swift index 774d4c461..3626090dd 100644 --- a/xdrip/View Controllers/BluetoothPeripheralsNavigationController/BluetoothPeripheralsViewController/BluetoothPeripheralViewController/Models/HeartBeat/DexcomG7HeartBeatBluetoothPeripheralViewModel.swift +++ b/xdrip/View Controllers/BluetoothPeripheralsNavigationController/BluetoothPeripheralsViewController/BluetoothPeripheralViewController/Models/HeartBeat/DexcomG7HeartBeatBluetoothPeripheralViewModel.swift @@ -37,7 +37,7 @@ extension DexcomG7HeartBeatBluetoothPeripheralViewModel: BluetoothPeripheralView func sectionTitle(forSection section: Int) -> String { // there's no section specific for this type of transmitter, this function will not be called - return "Dexcom G7/ONE+ Heartbeat ♥" + return "Dexcom G7/ONE+/Stelo Heartbeat ♥" } From 0fd9a3bfe38921478ee517f394d42ddd75809612 Mon Sep 17 00:00:00 2001 From: Paul Plant <37302780+paulplant@users.noreply.github.com> Date: Sat, 19 Oct 2024 00:50:59 +0200 Subject: [PATCH 4/5] fix crash in WatchManager() when no readings --- xdrip/Managers/Watch/WatchManager.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xdrip/Managers/Watch/WatchManager.swift b/xdrip/Managers/Watch/WatchManager.swift index b400ad748..eb0e27162 100644 --- a/xdrip/Managers/Watch/WatchManager.swift +++ b/xdrip/Managers/Watch/WatchManager.swift @@ -69,7 +69,7 @@ final class WatchManager: NSObject, ObservableObject { var deltaValueInUserUnit: Double = 0.0 // add delta if available - if bgReadings.count > 0 { + if bgReadings.count > 1 { previousValueInUserUnit = bgReadings[1].calculatedValue.mgDlToMmol(mgDl: isMgDl) actualValueInUserUnit = bgReadings[0].calculatedValue.mgDlToMmol(mgDl: isMgDl) From 05f27a1a962a14c3b69a39e0ee0e1adf75739805 Mon Sep 17 00:00:00 2001 From: Paul Plant <37302780+paulplant@users.noreply.github.com> Date: Sat, 19 Oct 2024 00:53:28 +0200 Subject: [PATCH 5/5] translation updates --- xdrip/Storyboards/de.lproj/BluetoothPeripheralView.strings | 1 + xdrip/Storyboards/de.lproj/Common.strings | 2 ++ xdrip/Storyboards/de.lproj/SettingsViews.strings | 2 +- xdrip/Storyboards/fr.lproj/HomeView.strings | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/xdrip/Storyboards/de.lproj/BluetoothPeripheralView.strings b/xdrip/Storyboards/de.lproj/BluetoothPeripheralView.strings index 1d837dae0..22a4e0732 100644 --- a/xdrip/Storyboards/de.lproj/BluetoothPeripheralView.strings +++ b/xdrip/Storyboards/de.lproj/BluetoothPeripheralView.strings @@ -135,3 +135,4 @@ "confirmAlgorithmChangeToxDripMessage" = "itte um Bestätigung, dass zum xDrip Algorithmus gewechselt werden soll.\n\nDies stoppt für kurze Zeit die Datenübermittlung und Du wirst um einen initialen Kalibrierungswert (Blut) gebeten."; "confirmCalibrationChangeToSinglePointMessage" = "Bitte um Bestätigung, dass zur Standard Kalibrierung gewechselt werden soll.\n\nDies stoppt für kurze Zeit die Datenübermittlung und Du wirst um einen initialen Kalibrierungswert (Blut) gebeten."; "confirmCalibrationChangeToMultiPointMessage" = "Bitte um Bestätigung, dass zur Mehrpunkt Kalibrierung gewechselt werden soll.\n\n⚠️ Diese Methode ist nur für erfahrene Benutzer, es könnte ein falscher und damit gefährlicher Wert angezeigt werden, wenn die Kalibrierung nicht korrekt durchgeführt wurde.\n\nWenn Du unsicher bist, bitte drücke Abbruch/Cancel."; +"confirm" = "Bestätigen"; diff --git a/xdrip/Storyboards/de.lproj/Common.strings b/xdrip/Storyboards/de.lproj/Common.strings index 74b42fb10..d52d08f64 100644 --- a/xdrip/Storyboards/de.lproj/Common.strings +++ b/xdrip/Storyboards/de.lproj/Common.strings @@ -132,3 +132,5 @@ /// the words in user range "common_statistics_userRange" = "User Range"; + +"common_notRequired" = "Nicht Erforderlich"; diff --git a/xdrip/Storyboards/de.lproj/SettingsViews.strings b/xdrip/Storyboards/de.lproj/SettingsViews.strings index e96476799..6c9ee9046 100644 --- a/xdrip/Storyboards/de.lproj/SettingsViews.strings +++ b/xdrip/Storyboards/de.lproj/SettingsViews.strings @@ -320,7 +320,7 @@ "settingsviews_webooptransmitter" = "Use Transmitter Algorithm"; /// weboop settings, title of the dialogs where user can select between xdrip or transmitter algorithm -"settingsviews_labelWebOOP" = "xDrip or Transmitter Algorithm"; +"settingsviews_labelWebOOP" = "xdrip oder nativer Algorithmus"; "settingsviews_showHelpIcon" = "Hilfe-Symbol anzeigen"; "settingsviews_restartNeeded" = "(Neustart notwendig)"; diff --git a/xdrip/Storyboards/fr.lproj/HomeView.strings b/xdrip/Storyboards/fr.lproj/HomeView.strings index fd97cb802..4caab3f19 100644 --- a/xdrip/Storyboards/fr.lproj/HomeView.strings +++ b/xdrip/Storyboards/fr.lproj/HomeView.strings @@ -20,7 +20,7 @@ "notknown" = "Inconnu"; "lastconnection" = "Dernière Connexion"; "transmitterbatterylevel" = "Niveau de batterie (Transmitteur)"; -"ago" = "passée(s)"; +"ago" = "avant"; "licenseinfo" = "This program is free software distributed under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.\r\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.\r\n\nSee http://www.gnu.org/licenses/gpl.txt for more details.\r\n\r\nInfo: "; "info" = "Informations"; "transmitterinfo" = "Tout d'abord, allez sur l'écran Bluetooth où vous pourrez ajouter et scanner votre transmetteur.\r\n\nPuis revenir sur l'écran d'accueil pour démarrer le capteur.";