|
@@ -347,10 +347,13 @@ final class BaseAPSManager: APSManager, Injectable {
|
|
|
return Just(false).eraseToAnyPublisher()
|
|
return Just(false).eraseToAnyPublisher()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- guard glucoseStorage.isGlucoseNotFlat() else {
|
|
|
|
|
- debug(.apsManager, "Glucose data is too flat")
|
|
|
|
|
- processError(APSError.glucoseError(message: "Glucose data is too flat"))
|
|
|
|
|
- return Just(false).eraseToAnyPublisher()
|
|
|
|
|
|
|
+ // Only let glucose be flat when 400 mg/dl
|
|
|
|
|
+ if (glucoseStorage.recent().last?.glucose ?? 100) != 400 {
|
|
|
|
|
+ guard glucoseStorage.isGlucoseNotFlat() else {
|
|
|
|
|
+ debug(.apsManager, "Glucose data is too flat")
|
|
|
|
|
+ processError(APSError.glucoseError(message: "Glucose data is too flat"))
|
|
|
|
|
+ return Just(false).eraseToAnyPublisher()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
let now = Date()
|
|
let now = Date()
|
|
@@ -941,7 +944,29 @@ final class BaseAPSManager: APSManager, Injectable {
|
|
|
let buildDate = Bundle.main.buildDate
|
|
let buildDate = Bundle.main.buildDate
|
|
|
let version = Bundle.main.releaseVersionNumber
|
|
let version = Bundle.main.releaseVersionNumber
|
|
|
let build = Bundle.main.buildVersionNumber
|
|
let build = Bundle.main.buildVersionNumber
|
|
|
- let branch = Bundle.main.infoDictionary?["BuildBranch"] as? String ?? ""
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // Read branch information from branch.txt instead of infoDictionary
|
|
|
|
|
+ var branch = "Unknown"
|
|
|
|
|
+ if let branchFileURL = Bundle.main.url(forResource: "branch", withExtension: "txt"),
|
|
|
|
|
+ let branchFileContent = try? String(contentsOf: branchFileURL)
|
|
|
|
|
+ {
|
|
|
|
|
+ let lines = branchFileContent.components(separatedBy: .newlines)
|
|
|
|
|
+ for line in lines {
|
|
|
|
|
+ let components = line.components(separatedBy: "=")
|
|
|
|
|
+ if components.count == 2 {
|
|
|
|
|
+ let key = components[0].trimmingCharacters(in: .whitespaces)
|
|
|
|
|
+ let value = components[1].trimmingCharacters(in: .whitespaces)
|
|
|
|
|
+
|
|
|
|
|
+ if key == "BRANCH" {
|
|
|
|
|
+ branch = value
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ branch = "Unknown"
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
let copyrightNotice_ = Bundle.main.infoDictionary?["NSHumanReadableCopyright"] as? String ?? ""
|
|
let copyrightNotice_ = Bundle.main.infoDictionary?["NSHumanReadableCopyright"] as? String ?? ""
|
|
|
let pump_ = pumpManager?.localizedTitle ?? ""
|
|
let pump_ = pumpManager?.localizedTitle ?? ""
|
|
|
let cgm = settingsManager.settings.cgm
|
|
let cgm = settingsManager.settings.cgm
|