Power saving improvements

This commit is contained in:
Ali
2023-02-24 18:08:30 +04:00
parent 96496aabd9
commit de29a6b54b
55 changed files with 1551 additions and 411 deletions

View File

@@ -1009,6 +1009,21 @@ 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)
})