mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Refactoring
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
import MtProtoKit
|
||||
import SyncCore
|
||||
|
||||
public func updateLoggingSettings(accountManager: AccountManager, _ f: @escaping (LoggingSettings) -> LoggingSettings) -> Signal<Void, NoError> {
|
||||
return accountManager.transaction { transaction -> Void in
|
||||
var updated: LoggingSettings?
|
||||
transaction.updateSharedData(SharedDataKeys.loggingSettings, { current in
|
||||
if let current = current as? LoggingSettings {
|
||||
updated = f(current)
|
||||
return updated
|
||||
} else {
|
||||
updated = f(LoggingSettings.defaultSettings)
|
||||
return updated
|
||||
}
|
||||
})
|
||||
|
||||
if let updated = updated {
|
||||
Logger.shared.logToFile = updated.logToFile
|
||||
Logger.shared.logToConsole = updated.logToConsole
|
||||
Logger.shared.redactSensitiveData = updated.redactSensitiveData
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user