Преглед изворни кода

Revert Hide Glucose Badge

(cherry picked from commit 560025bb03c033836be4d6c80547bf58bbfdf034)
Jon Mårtensson пре 3 година
родитељ
комит
0fbd64d5da

+ 0 - 5
FreeAPS/Sources/Models/FreeAPSSettings.swift

@@ -17,7 +17,6 @@ struct FreeAPSSettings: JSON, Equatable {
     var useCalendar: Bool = false
     var useCalendar: Bool = false
     var useAppleHealth: Bool = false
     var useAppleHealth: Bool = false
     var glucoseBadge: Bool = false
     var glucoseBadge: Bool = false
-    var tooOldGlucose: Bool = false
     var glucoseNotificationsAlways: Bool = false
     var glucoseNotificationsAlways: Bool = false
     var useAlarmSound: Bool = false
     var useAlarmSound: Bool = false
     var addSourceInfoToGlucoseNotifications: Bool = false
     var addSourceInfoToGlucoseNotifications: Bool = false
@@ -104,10 +103,6 @@ extension FreeAPSSettings: Decodable {
             settings.glucoseBadge = glucoseBadge
             settings.glucoseBadge = glucoseBadge
         }
         }
 
 
-        if let tooOldGlucose = try? container.decode(Bool.self, forKey: .tooOldGlucose) {
-            settings.tooOldGlucose = tooOldGlucose
-        }
-
         if let useFPUconversion = try? container.decode(Bool.self, forKey: .useFPUconversion) {
         if let useFPUconversion = try? container.decode(Bool.self, forKey: .useFPUconversion) {
             settings.useFPUconversion = useFPUconversion
             settings.useFPUconversion = useFPUconversion
         }
         }

+ 0 - 2
FreeAPS/Sources/Modules/NotificationsConfig/NotificationsConfigStateModel.swift

@@ -3,7 +3,6 @@ import SwiftUI
 extension NotificationsConfig {
 extension NotificationsConfig {
     final class StateModel: BaseStateModel<Provider> {
     final class StateModel: BaseStateModel<Provider> {
         @Published var glucoseBadge = false
         @Published var glucoseBadge = false
-        @Published var tooOldGlucose = false
         @Published var glucoseNotificationsAlways = false
         @Published var glucoseNotificationsAlways = false
         @Published var useAlarmSound = false
         @Published var useAlarmSound = false
         @Published var addSourceInfoToGlucoseNotifications = false
         @Published var addSourceInfoToGlucoseNotifications = false
@@ -17,7 +16,6 @@ extension NotificationsConfig {
             self.units = units
             self.units = units
 
 
             subscribeSetting(\.glucoseBadge, on: $glucoseBadge) { glucoseBadge = $0 }
             subscribeSetting(\.glucoseBadge, on: $glucoseBadge) { glucoseBadge = $0 }
-            subscribeSetting(\.tooOldGlucose, on: $tooOldGlucose) { tooOldGlucose = $0 }
             subscribeSetting(\.glucoseNotificationsAlways, on: $glucoseNotificationsAlways) { glucoseNotificationsAlways = $0 }
             subscribeSetting(\.glucoseNotificationsAlways, on: $glucoseNotificationsAlways) { glucoseNotificationsAlways = $0 }
             subscribeSetting(\.useAlarmSound, on: $useAlarmSound) { useAlarmSound = $0 }
             subscribeSetting(\.useAlarmSound, on: $useAlarmSound) { useAlarmSound = $0 }
             subscribeSetting(\.addSourceInfoToGlucoseNotifications, on: $addSourceInfoToGlucoseNotifications) {
             subscribeSetting(\.addSourceInfoToGlucoseNotifications, on: $addSourceInfoToGlucoseNotifications) {

+ 0 - 1
FreeAPS/Sources/Modules/NotificationsConfig/View/NotificationsConfigRootView.swift

@@ -28,7 +28,6 @@ extension NotificationsConfig {
             Form {
             Form {
                 Section(header: Text("Glucose")) {
                 Section(header: Text("Glucose")) {
                     Toggle("Show glucose on the app badge", isOn: $state.glucoseBadge)
                     Toggle("Show glucose on the app badge", isOn: $state.glucoseBadge)
-                    Toggle("Hide glucose badge when older than 20 minutes", isOn: $state.tooOldGlucose)
                     Toggle("Always Notify Glucose", isOn: $state.glucoseNotificationsAlways)
                     Toggle("Always Notify Glucose", isOn: $state.glucoseNotificationsAlways)
                     Toggle("Also play alert sound", isOn: $state.useAlarmSound)
                     Toggle("Also play alert sound", isOn: $state.useAlarmSound)
                     Toggle("Also add source info", isOn: $state.addSourceInfoToGlucoseNotifications)
                     Toggle("Also add source info", isOn: $state.addSourceInfoToGlucoseNotifications)

+ 0 - 9
FreeAPS/Sources/Services/UserNotifiactions/UserNotificationsManager.swift

@@ -191,15 +191,6 @@ final class BaseUserNotificationsManager: NSObject, UserNotificationsManager, In
 
 
         addAppBadge(glucose: lastGlucose.glucose)
         addAppBadge(glucose: lastGlucose.glucose)
 
 
-        if settingsManager.settings.tooOldGlucose {
-            DispatchQueue.main.asyncAfter(deadline: .now() + 1200) {
-                // Make check double to remove the nil in case not needed anymore...
-                if lastGlucose.dateString.addingTimeInterval(19.minutes.timeInterval) < Date() {
-                    self.addAppBadge(glucose: nil)
-                }
-            }
-        }
-
         guard glucoseStorage.alarm != nil || settingsManager.settings.glucoseNotificationsAlways else {
         guard glucoseStorage.alarm != nil || settingsManager.settings.glucoseNotificationsAlways else {
             return
             return
         }
         }