Low power improvements

This commit is contained in:
Ali
2023-02-28 22:20:44 +04:00
parent fb025d5b14
commit a11de52d56
25 changed files with 155 additions and 234 deletions

View File

@@ -337,6 +337,10 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
self.window = window
self.nativeWindow = window
if !UIDevice.current.isBatteryMonitoringEnabled {
UIDevice.current.isBatteryMonitoringEnabled = true
}
let clearNotificationsManager = ClearNotificationsManager(getNotificationIds: { completion in
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().getDeliveredNotifications(completionHandler: { notifications in
@@ -1009,21 +1013,6 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
Logger.shared.logToConsole = loggingSettings.logToConsole
Logger.shared.redactSensitiveData = loggingSettings.redactSensitiveData
Queue.mainQueue().async {
var previousValue: Bool?
let _ = (sharedApplicationContext.sharedContext.automaticMediaDownloadSettings
|> mapToSignal { settings -> Signal<Bool, NoError> in
return automaticEnergyUsageShouldBeOn(settings: settings)
}
|> distinctUntilChanged).start(next: { isPowerSavingEnabled in
let previousValueValue = previousValue
previousValue = isPowerSavingEnabled
if isPowerSavingEnabled != previousValueValue && previousValueValue != nil {
}
})
}
return .single(sharedApplicationContext)
})