mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-04 05:26:48 +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 extension Api {
|
||||||
public struct functions {
|
public struct functions {
|
||||||
|
|||||||
@ -1,5 +1,17 @@
|
|||||||
import Foundation
|
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> {
|
public final class DeserializeFunctionResponse<T> {
|
||||||
private let f: (Buffer) -> 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?] = {
|
fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||||
var dict: [Int32 : (BufferReader) -> Any?] = [:]
|
var dict: [Int32 : (BufferReader) -> Any?] = [:]
|
||||||
|
|||||||
@ -448,7 +448,8 @@ private final class NetworkHelper: NSObject, MTContextChangeListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func contextApiEnvironmentUpdated(_ context: MTContext!, apiEnvironment: MTApiEnvironment!) {
|
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.queue = queue
|
||||||
self.datacenterId = datacenterId
|
self.datacenterId = datacenterId
|
||||||
self.context = context
|
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.mtProto = mtProto
|
||||||
self.requestService = requestService
|
self.requestService = requestService
|
||||||
self.connectionStatusDelegate = connectionStatusDelegate
|
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?] = {
|
fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||||
var dict: [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?] = {
|
fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||||
var dict: [Int32 : (BufferReader) -> Any?] = [:]
|
var dict: [Int32 : (BufferReader) -> Any?] = [:]
|
||||||
dict[-1471112230] = { return $0.readInt32() }
|
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?] = {
|
fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||||
var dict: [Int32 : (BufferReader) -> Any?] = [:]
|
var dict: [Int32 : (BufferReader) -> Any?] = [:]
|
||||||
|
|||||||
@ -5,10 +5,24 @@ import Foundation
|
|||||||
import MtProtoKitDynamic
|
import MtProtoKitDynamic
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if os(macOS)
|
||||||
|
private let apiPrefix = "TelegramCoreMac.Api."
|
||||||
|
#else
|
||||||
private let apiPrefix = "TelegramCore.Api."
|
private let apiPrefix = "TelegramCore.Api."
|
||||||
|
#endif
|
||||||
|
|
||||||
private let apiPrefixLength = apiPrefix.count
|
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 {
|
private func recursiveDescription(redact: Bool, of value: Any) -> String {
|
||||||
|
//if value is
|
||||||
let mirror = Mirror(reflecting: value)
|
let mirror = Mirror(reflecting: value)
|
||||||
var result = ""
|
var result = ""
|
||||||
if let displayStyle = mirror.displayStyle {
|
if let displayStyle = mirror.displayStyle {
|
||||||
@ -24,6 +38,12 @@ private func recursiveDescription(redact: Bool, of value: Any) -> String {
|
|||||||
result.append(".")
|
result.append(".")
|
||||||
result.append(label)
|
result.append(label)
|
||||||
}
|
}
|
||||||
|
let redactChildren: Set<String>?
|
||||||
|
if redact {
|
||||||
|
redactChildren = redactChildrenOfType[result]
|
||||||
|
} else {
|
||||||
|
redactChildren = nil
|
||||||
|
}
|
||||||
let valueMirror = Mirror(reflecting: child.value)
|
let valueMirror = Mirror(reflecting: child.value)
|
||||||
if let displayStyle = valueMirror.displayStyle {
|
if let displayStyle = valueMirror.displayStyle {
|
||||||
switch displayStyle {
|
switch displayStyle {
|
||||||
@ -36,11 +56,23 @@ private func recursiveDescription(redact: Bool, of value: Any) -> String {
|
|||||||
} else {
|
} else {
|
||||||
result.append(", ")
|
result.append(", ")
|
||||||
}
|
}
|
||||||
|
var redactValue: Bool = false
|
||||||
|
if let redactChildren = redactChildren, redactChildren.contains("*") {
|
||||||
|
redactValue = true
|
||||||
|
}
|
||||||
if let label = child.label {
|
if let label = child.label {
|
||||||
result.append(label)
|
result.append(label)
|
||||||
result.append(": ")
|
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 {
|
if hadChildren {
|
||||||
result.append(")")
|
result.append(")")
|
||||||
@ -48,6 +80,10 @@ private func recursiveDescription(redact: Bool, of value: Any) -> String {
|
|||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
result.append("(")
|
||||||
|
result.append(String(describing: child.value))
|
||||||
|
result.append(")")
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -82,7 +118,7 @@ public class BoxedMessage: NSObject {
|
|||||||
get {
|
get {
|
||||||
let redact: Bool
|
let redact: Bool
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
redact = false
|
redact = true
|
||||||
#else
|
#else
|
||||||
redact = true
|
redact = true
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user