mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Refactoring
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
import MtProtoKit
|
||||
|
||||
import SyncCore
|
||||
|
||||
public func updateContentPrivacySettings(postbox: Postbox, _ f: @escaping (ContentPrivacySettings) -> ContentPrivacySettings) -> Signal<Void, NoError> {
|
||||
return postbox.transaction { transaction -> Void in
|
||||
var updated: ContentPrivacySettings?
|
||||
transaction.updatePreferencesEntry(key: PreferencesKeys.contentPrivacySettings, { current in
|
||||
if let current = current as? ContentPrivacySettings {
|
||||
updated = f(current)
|
||||
return updated
|
||||
} else {
|
||||
updated = f(ContentPrivacySettings.defaultSettings)
|
||||
return updated
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user