diff --git a/xdrip/Extensions/UserDefaults.swift b/xdrip/Extensions/UserDefaults.swift index af68a6b52..71b7ebe03 100644 --- a/xdrip/Extensions/UserDefaults.swift +++ b/xdrip/Extensions/UserDefaults.swift @@ -362,7 +362,7 @@ extension UserDefaults { /// - stored as data as read from transmitter case librePatchInfo = "librePatchInfo" - case setActiveGCM = "setActiveGCM" + case setActiveCGM = "setActiveCGM" } @@ -806,12 +806,12 @@ extension UserDefaults { } } - @objc dynamic var setActiveGCM: Bool { + @objc dynamic var setActiveCGM: Bool { get { - return bool(forKey: Key.setActiveGCM.rawValue) + return bool(forKey: Key.setActiveCGM.rawValue) } set { - set(newValue, forKey: Key.setActiveGCM.rawValue) + set(newValue, forKey: Key.setActiveCGM.rawValue) } } diff --git a/xdrip/Managers/Alerts/AlertManager.swift b/xdrip/Managers/Alerts/AlertManager.swift index c7619bfb9..c150bc7e3 100644 --- a/xdrip/Managers/Alerts/AlertManager.swift +++ b/xdrip/Managers/Alerts/AlertManager.swift @@ -113,7 +113,7 @@ public class AlertManager:NSObject { /// - if true then an immediate notification is created (immediate being not a future planned, like missed reading), which contains the bg reading in the text - so there's no need to create an additional notificationwith the text in it public func checkAlerts(maxAgeOfLastBgReadingInSeconds:Double) -> Bool { - if !UserDefaults.standard.setActiveGCM { + if !UserDefaults.standard.setActiveCGM { return false } diff --git a/xdrip/Managers/DexcomShare/DexcomShareUploadManager.swift b/xdrip/Managers/DexcomShare/DexcomShareUploadManager.swift index ebe100100..88048cdfa 100644 --- a/xdrip/Managers/DexcomShare/DexcomShareUploadManager.swift +++ b/xdrip/Managers/DexcomShare/DexcomShareUploadManager.swift @@ -70,7 +70,7 @@ class DexcomShareUploadManager:NSObject { /// - lastConnectionStatusChangeTimeStamp : when was the last transmitter dis/reconnect - if nil then 1 1 1970 is used public func uploadLatestBgReadings(lastConnectionStatusChangeTimeStamp: Date?) { - if !UserDefaults.standard.setActiveGCM {return} + if !UserDefaults.standard.setActiveCGM {return} // check if dexcomShare is enabled guard UserDefaults.standard.uploadReadingstoDexcomShare else { diff --git a/xdrip/Managers/Loop/LoopManager.swift b/xdrip/Managers/Loop/LoopManager.swift index 9f1c2f06b..5986a75ad 100644 --- a/xdrip/Managers/Loop/LoopManager.swift +++ b/xdrip/Managers/Loop/LoopManager.swift @@ -43,7 +43,7 @@ public class LoopManager:NSObject { /// share latest readings with Loop public func share() { - if !UserDefaults.standard.setActiveGCM {return} + if !UserDefaults.standard.setActiveCGM {return} // unwrap sharedUserDefaults guard let sharedUserDefaults = sharedUserDefaults else {return} diff --git a/xdrip/View Controllers/SettingsNavigationController/SettingsViewController/SettingsViewModels/SettingsViewGeneralSettingsViewModel.swift b/xdrip/View Controllers/SettingsNavigationController/SettingsViewController/SettingsViewModels/SettingsViewGeneralSettingsViewModel.swift index 011496ca7..557be2f36 100644 --- a/xdrip/View Controllers/SettingsNavigationController/SettingsViewController/SettingsViewModels/SettingsViewGeneralSettingsViewModel.swift +++ b/xdrip/View Controllers/SettingsNavigationController/SettingsViewController/SettingsViewModels/SettingsViewGeneralSettingsViewModel.swift @@ -3,7 +3,7 @@ import UIKit fileprivate enum Setting:Int, CaseIterable { /// Toggle to set as active CGM for APS and Dexom share upload etc - case setActiveGCM = 0 + case setActiveCGM = 0 /// blood glucose unit case bloodGlucoseUnit = 1 @@ -63,7 +63,7 @@ class SettingsViewGeneralSettingsViewModel: SettingsViewModelProtocol { switch setting { - case .setActiveGCM: + case .setActiveCGM: return .nothing case .bloodGlucoseUnit: @@ -149,7 +149,7 @@ class SettingsViewGeneralSettingsViewModel: SettingsViewModelProtocol { switch setting { - case .setActiveGCM: + case .setActiveCGM: return "Set as active CGM" case .bloodGlucoseUnit: @@ -178,7 +178,7 @@ class SettingsViewGeneralSettingsViewModel: SettingsViewModelProtocol { switch setting { - case .setActiveGCM: + case .setActiveCGM: return UITableViewCell.AccessoryType.none case .bloodGlucoseUnit: @@ -201,7 +201,7 @@ class SettingsViewGeneralSettingsViewModel: SettingsViewModelProtocol { switch setting { - case .setActiveGCM: + case .setActiveCGM: return nil case .bloodGlucoseUnit: @@ -224,12 +224,13 @@ class SettingsViewGeneralSettingsViewModel: SettingsViewModelProtocol { switch setting { - case .setActiveGCM: - return UISwitch(isOn: UserDefaults.standard.setActiveGCM, action: { + case .setActiveCGM: + return UISwitch(isOn: UserDefaults.standard.setActiveCGM, action: { (isOn:Bool) in - UserDefaults.standard.setActiveGCM = isOn + UserDefaults.standard.setActiveCGM = isOn UserDefaults.standard.showReadingInAppBadge = isOn + UserDefaults.standard.suppressLoopShare = !isOn if !isOn { let uNUserNotificationCenter = UNUserNotificationCenter.current()