Files
ghostgram/submodules/TelegramCore/Sources/Settings/CacheStorageSettings.swift
T
ichmagmaus111andClaude Opus 5.5 0622057a4f Ghostgram: open-source release
Ghostgram for iOS, rebuilt from scratch on Telegram iOS 13.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 17:57:09 +01:00

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))
})
}
}