Don't count battery level as low if it's not available (lower than zero)

This commit is contained in:
Ilya Laktyushin
2020-08-10 16:51:13 +03:00
parent d2f712266b
commit 032cff7de1

View File

@@ -641,7 +641,7 @@ public final class PresentationCallImpl: PresentationCall {
var previousBatteryLevelIsLow = false
let timer = SwiftSignalKit.Timer(timeout: 30.0, repeat: true, completion: {
let batteryLevelIsLow = device.batteryLevel < 0.1 && device.batteryState != .charging
let batteryLevelIsLow = device.batteryLevel >= 0.0 && device.batteryLevel < 0.1 && device.batteryState != .charging
if batteryLevelIsLow != previousBatteryLevelIsLow {
previousBatteryLevelIsLow = batteryLevelIsLow
subscriber.putNext(batteryLevelIsLow)