Files
GLEGram-iOS/submodules/TelegramCore/Sources/Settings/ProxySettings.swift
T
Leeksov 4647310322 GLEGram 12.5 — Initial public release
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.
2026-04-06 09:48:12 +03:00

33 lines
1.4 KiB
Swift

import Foundation
import Postbox
import SwiftSignalKit
import MtProtoKit
public func updateProxySettingsInteractively(accountManager: AccountManager<TelegramAccountManagerTypes>, _ f: @escaping (ProxySettings) -> ProxySettings) -> Signal<Bool, NoError> {
return accountManager.transaction { transaction -> Bool in
return updateProxySettingsInteractively(transaction: transaction, f)
}
}
extension ProxyServerSettings {
var mtProxySettings: MTSocksProxySettings {
switch self.connection {
case let .socks5(username, password):
return MTSocksProxySettings(ip: self.host, port: UInt16(clamping: self.port), username: username, password: password, secret: nil)
case let .mtp(secret):
return MTSocksProxySettings(ip: self.host, port: UInt16(clamping: self.port), username: nil, password: nil, secret: secret)
}
}
}
public func updateProxySettingsInteractively(transaction: AccountManagerModifier<TelegramAccountManagerTypes>, _ f: @escaping (ProxySettings) -> ProxySettings) -> Bool {
var hasChanges = false
transaction.updateSharedData(SharedDataKeys.proxySettings, { current in
let previous = current?.get(ProxySettings.self) ?? ProxySettings.defaultSettings
let updated = f(previous)
hasChanges = previous != updated
return PreferencesEntry(updated)
})
return hasChanges
}