From 032cff7de1c386fdf476222d55abb89d592923b1 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Mon, 10 Aug 2020 16:51:13 +0300 Subject: [PATCH] Don't count battery level as low if it's not available (lower than zero) --- submodules/TelegramCallsUI/Sources/PresentationCall.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/TelegramCallsUI/Sources/PresentationCall.swift b/submodules/TelegramCallsUI/Sources/PresentationCall.swift index c83e70db06..3a8a21f31c 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationCall.swift @@ -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)