mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Low power improvements
This commit is contained in:
@@ -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)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user