From f135676d363fd4b2c81b0fd8c19f0ce429f2fbeb Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 22 Mar 2024 00:12:57 +0300 Subject: [PATCH] Added support for sending state of low level of battery. --- Telegram/SourceFiles/calls/calls_call.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index 6b459e2ad..107ca4eeb 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/boxes/confirm_box.h" #include "ui/boxes/rate_call_box.h" #include "calls/calls_instance.h" +#include "base/battery_saving.h" #include "base/openssl_help.h" #include "base/random.h" #include "mtproto/mtproto_dh_utils.h" @@ -1070,6 +1071,15 @@ void Call::createAndStartController(const MTPDphoneCall &call) { _muted.value() | rpl::start_with_next([=](bool muted) { Core::App().mediaDevices().setCaptureMuted(muted); }, _instanceLifetime); + + Core::App().batterySaving().value( + ) | rpl::start_with_next([=](bool isSaving) { + crl::on_main(weak, [=] { + if (_instance) { + _instance->setIsLowBatteryLevel(isSaving); + } + }); + }, _instanceLifetime); } void Call::handleControllerStateChange(tgcalls::State state) {