mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-04-25 04:16:58 +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.
28 lines
1.0 KiB
Swift
28 lines
1.0 KiB
Swift
import Foundation
|
|
import Postbox
|
|
import SwiftSignalKit
|
|
|
|
|
|
func currentWebDocumentsHostDatacenterId(postbox: Postbox, isTestingEnvironment: Bool) -> Signal<Int32, NoError> {
|
|
return postbox.transaction { transaction -> Int32 in
|
|
if let entry = transaction.getPreferencesEntry(key: PreferencesKeys.remoteStorageConfiguration)?.get(RemoteStorageConfiguration.self) {
|
|
return entry.webDocumentsHostDatacenterId
|
|
} else {
|
|
if isTestingEnvironment {
|
|
return 2
|
|
} else {
|
|
return 4
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
func updateRemoteStorageConfiguration(transaction: Transaction, configuration: RemoteStorageConfiguration) {
|
|
let current = transaction.getPreferencesEntry(key: PreferencesKeys.remoteStorageConfiguration)?.get(RemoteStorageConfiguration.self)
|
|
if let current = current, current == configuration {
|
|
return
|
|
}
|
|
|
|
transaction.setPreferencesEntry(key: PreferencesKeys.remoteStorageConfiguration, value: PreferencesEntry(configuration))
|
|
}
|