|
@@ -342,24 +342,27 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
|
|
|
let status: String? = last.status
|
|
let status: String? = last.status
|
|
|
let display: Bool? = last.display
|
|
let display: Bool? = last.display
|
|
|
|
|
|
|
|
- if let percent = percent, let voltage = voltage, let status = status, let display = display {
|
|
|
|
|
|
|
+ if let status {
|
|
|
debugPrint(
|
|
debugPrint(
|
|
|
- "Home State Model: \(#function) \(DebuggingIdentifiers.succeeded) setup battery from core data successfully"
|
|
|
|
|
|
|
+ "NightscoutManager: \(#function) \(DebuggingIdentifiers.succeeded) setup battery from core data successfully"
|
|
|
)
|
|
)
|
|
|
return Battery(
|
|
return Battery(
|
|
|
percent: percent,
|
|
percent: percent,
|
|
|
voltage: voltage,
|
|
voltage: voltage,
|
|
|
- string: BatteryState(rawValue: status) ?? BatteryState.normal,
|
|
|
|
|
|
|
+ string: BatteryState(rawValue: status) ?? BatteryState.unknown,
|
|
|
display: display
|
|
display: display
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return Battery(percent: 100, voltage: 100, string: BatteryState.normal, display: false)
|
|
|
|
|
|
|
+ debugPrint(
|
|
|
|
|
+ "NightscoutManager: \(#function) \(DebuggingIdentifiers.succeeded) successfully fetched; but no battery data available. Returning fallback default."
|
|
|
|
|
+ )
|
|
|
|
|
+ return Battery(percent: nil, voltage: nil, string: BatteryState.error, display: nil)
|
|
|
} catch {
|
|
} catch {
|
|
|
debugPrint(
|
|
debugPrint(
|
|
|
- "Home State Model: \(#function) \(DebuggingIdentifiers.failed) failed to setup battery from core data"
|
|
|
|
|
|
|
+ "NightscoutManager: \(#function) \(DebuggingIdentifiers.failed) failed to setup battery from core data"
|
|
|
)
|
|
)
|
|
|
- return Battery(percent: 100, voltage: 100, string: BatteryState.normal, display: false)
|
|
|
|
|
|
|
+ return Battery(percent: nil, voltage: nil, string: BatteryState.error, display: nil)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -434,7 +437,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
|
|
|
iob: iob?.first,
|
|
iob: iob?.first,
|
|
|
suggested: modifiedSuggestedDetermination,
|
|
suggested: modifiedSuggestedDetermination,
|
|
|
enacted: settingsManager.settings.closedLoop ? fetchedEnactedDetermination : nil,
|
|
enacted: settingsManager.settings.closedLoop ? fetchedEnactedDetermination : nil,
|
|
|
- version: "0.7.1"
|
|
|
|
|
|
|
+ version: Bundle.main.releaseVersionNumber ?? "Unknown"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
// Gather all relevant data for NS Status
|
|
// Gather all relevant data for NS Status
|