mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-04-25 12:26:55 +02:00
4647310322
Based on Swiftgram 12.5 (Telegram iOS 12.5). All GLEGram features ported and organized in GLEGram/ folder. Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass, Font Replacement, Fake Profile, Chat Export, Plugin System, and more. See CHANGELOG_12.5.md for full details.
32 lines
1.5 KiB
Swift
32 lines
1.5 KiB
Swift
import Foundation
|
|
import Postbox
|
|
import SwiftSignalKit
|
|
|
|
public func updateCacheStorageSettingsInteractively(accountManager: AccountManager<TelegramAccountManagerTypes>, _ f: @escaping (CacheStorageSettings) -> CacheStorageSettings) -> Signal<Void, NoError> {
|
|
return accountManager.transaction { transaction -> Void in
|
|
transaction.updateSharedData(SharedDataKeys.cacheStorageSettings, { entry in
|
|
let currentSettings: CacheStorageSettings
|
|
if let entry = entry?.get(CacheStorageSettings.self) {
|
|
currentSettings = entry
|
|
} else {
|
|
currentSettings = CacheStorageSettings.defaultSettings
|
|
}
|
|
return PreferencesEntry(f(currentSettings))
|
|
})
|
|
}
|
|
}
|
|
|
|
public func updateAccountSpecificCacheStorageSettingsInteractively(postbox: Postbox, _ f: @escaping (AccountSpecificCacheStorageSettings) -> AccountSpecificCacheStorageSettings) -> Signal<Void, NoError> {
|
|
return postbox.transaction { transaction -> Void in
|
|
transaction.updatePreferencesEntry(key: PreferencesKeys.accountSpecificCacheStorageSettings, { entry in
|
|
let currentSettings: AccountSpecificCacheStorageSettings
|
|
if let entry = entry?.get(AccountSpecificCacheStorageSettings.self) {
|
|
currentSettings = entry
|
|
} else {
|
|
currentSettings = AccountSpecificCacheStorageSettings.defaultSettings
|
|
}
|
|
return PreferencesEntry(f(currentSettings))
|
|
})
|
|
}
|
|
}
|