mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-03 21:16:35 +00:00
no message
This commit is contained in:
parent
4c87427ade
commit
849299fdcf
@ -165,16 +165,6 @@ public struct phone {
|
||||
}
|
||||
}
|
||||
}
|
||||
private final class FunctionDescription: CustomStringConvertible {
|
||||
let generator: () -> String
|
||||
init(_ generator: @escaping () -> String) {
|
||||
self.generator = generator
|
||||
}
|
||||
|
||||
var description: String {
|
||||
return self.generator()
|
||||
}
|
||||
}
|
||||
|
||||
public extension Api {
|
||||
public struct functions {
|
||||
|
||||
@ -1,5 +1,17 @@
|
||||
import Foundation
|
||||
|
||||
public final class FunctionDescription: CustomStringConvertible {
|
||||
private let generator: () -> String
|
||||
|
||||
init(_ generator: @escaping () -> String) {
|
||||
self.generator = generator
|
||||
}
|
||||
|
||||
public var description: String {
|
||||
return self.generator()
|
||||
}
|
||||
}
|
||||
|
||||
public final class DeserializeFunctionResponse<T> {
|
||||
private let f: (Buffer) -> T?
|
||||
|
||||
|
||||
@ -1,15 +1,4 @@
|
||||
|
||||
fileprivate final class FunctionDescription: CustomStringConvertible {
|
||||
let generator: () -> String
|
||||
init(_ generator: @escaping () -> String) {
|
||||
self.generator = generator
|
||||
}
|
||||
|
||||
var description: String {
|
||||
return self.generator()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
var dict: [Int32 : (BufferReader) -> Any?] = [:]
|
||||
|
||||
@ -448,7 +448,8 @@ private final class NetworkHelper: NSObject, MTContextChangeListener {
|
||||
}
|
||||
|
||||
func contextApiEnvironmentUpdated(_ context: MTContext!, apiEnvironment: MTApiEnvironment!) {
|
||||
self.contextProxyIdUpdated(apiEnvironment.socksProxySettings.flatMap(NetworkContextProxyId.init(settings:)))
|
||||
let settings: MTSocksProxySettings? = apiEnvironment.socksProxySettings
|
||||
self.contextProxyIdUpdated(settings.flatMap(NetworkContextProxyId.init(settings:)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -510,7 +511,7 @@ public final class Network: NSObject, MTRequestMessageServiceDelegate {
|
||||
self.queue = queue
|
||||
self.datacenterId = datacenterId
|
||||
self.context = context
|
||||
self._contextProxyId = ValuePromise(context.apiEnvironment.socksProxySettings.flatMap(NetworkContextProxyId.init(settings:)), ignoreRepeated: true)
|
||||
self._contextProxyId = ValuePromise((context.apiEnvironment.socksProxySettings as MTSocksProxySettings?).flatMap(NetworkContextProxyId.init(settings:)), ignoreRepeated: true)
|
||||
self.mtProto = mtProto
|
||||
self.requestService = requestService
|
||||
self.connectionStatusDelegate = connectionStatusDelegate
|
||||
|
||||
@ -1,14 +1,4 @@
|
||||
|
||||
fileprivate final class FunctionDescription: CustomStringConvertible {
|
||||
let generator: () -> String
|
||||
init(_ generator: @escaping () -> String) {
|
||||
self.generator = generator
|
||||
}
|
||||
|
||||
var description: String {
|
||||
return self.generator()
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
var dict: [Int32 : (BufferReader) -> Any?] = [:]
|
||||
|
||||
@ -1,15 +1,4 @@
|
||||
|
||||
fileprivate final class FunctionDescription: CustomStringConvertible {
|
||||
let generator: () -> String
|
||||
init(_ generator: @escaping () -> String) {
|
||||
self.generator = generator
|
||||
}
|
||||
|
||||
var description: String {
|
||||
return self.generator()
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
var dict: [Int32 : (BufferReader) -> Any?] = [:]
|
||||
dict[-1471112230] = { return $0.readInt32() }
|
||||
|
||||
@ -1,14 +1,4 @@
|
||||
|
||||
fileprivate final class FunctionDescription: CustomStringConvertible {
|
||||
let generator: () -> String
|
||||
init(_ generator: @escaping () -> String) {
|
||||
self.generator = generator
|
||||
}
|
||||
|
||||
var description: String {
|
||||
return self.generator()
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
var dict: [Int32 : (BufferReader) -> Any?] = [:]
|
||||
|
||||
@ -5,10 +5,24 @@ import Foundation
|
||||
import MtProtoKitDynamic
|
||||
#endif
|
||||
|
||||
#if os(macOS)
|
||||
private let apiPrefix = "TelegramCoreMac.Api."
|
||||
#else
|
||||
private let apiPrefix = "TelegramCore.Api."
|
||||
#endif
|
||||
|
||||
private let apiPrefixLength = apiPrefix.count
|
||||
|
||||
private let redactChildrenOfType: [String: Set<String>] = [
|
||||
"Message.message": Set(["message"]),
|
||||
"Updates.updateShortMessage": Set(["message"]),
|
||||
"Updates.updateShortChatMessage": Set(["message"]),
|
||||
"BotInlineMessage.botInlineMessageText": Set(["message"]),
|
||||
"DraftMessage.draftMessage": Set(["message"])
|
||||
]
|
||||
|
||||
private func recursiveDescription(redact: Bool, of value: Any) -> String {
|
||||
//if value is
|
||||
let mirror = Mirror(reflecting: value)
|
||||
var result = ""
|
||||
if let displayStyle = mirror.displayStyle {
|
||||
@ -24,6 +38,12 @@ private func recursiveDescription(redact: Bool, of value: Any) -> String {
|
||||
result.append(".")
|
||||
result.append(label)
|
||||
}
|
||||
let redactChildren: Set<String>?
|
||||
if redact {
|
||||
redactChildren = redactChildrenOfType[result]
|
||||
} else {
|
||||
redactChildren = nil
|
||||
}
|
||||
let valueMirror = Mirror(reflecting: child.value)
|
||||
if let displayStyle = valueMirror.displayStyle {
|
||||
switch displayStyle {
|
||||
@ -36,11 +56,23 @@ private func recursiveDescription(redact: Bool, of value: Any) -> String {
|
||||
} else {
|
||||
result.append(", ")
|
||||
}
|
||||
var redactValue: Bool = false
|
||||
if let redactChildren = redactChildren, redactChildren.contains("*") {
|
||||
redactValue = true
|
||||
}
|
||||
if let label = child.label {
|
||||
result.append(label)
|
||||
result.append(": ")
|
||||
if let redactChildren = redactChildren, redactChildren.contains(label) {
|
||||
redactValue = true
|
||||
}
|
||||
}
|
||||
|
||||
if redactValue {
|
||||
result.append("[[redacted]]")
|
||||
} else {
|
||||
result.append(recursiveDescription(redact: redact, of: child.value))
|
||||
}
|
||||
result.append(recursiveDescription(redact: redact, of: child.value))
|
||||
}
|
||||
if hadChildren {
|
||||
result.append(")")
|
||||
@ -48,6 +80,10 @@ private func recursiveDescription(redact: Bool, of value: Any) -> String {
|
||||
default:
|
||||
break
|
||||
}
|
||||
} else {
|
||||
result.append("(")
|
||||
result.append(String(describing: child.value))
|
||||
result.append(")")
|
||||
}
|
||||
break
|
||||
}
|
||||
@ -82,7 +118,7 @@ public class BoxedMessage: NSObject {
|
||||
get {
|
||||
let redact: Bool
|
||||
#if DEBUG
|
||||
redact = false
|
||||
redact = true
|
||||
#else
|
||||
redact = true
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user