mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-29 00:50:40 +00:00
Add debugging
This commit is contained in:
parent
a23971c0ef
commit
c4d10d07fe
@ -3,7 +3,7 @@
|
||||
@implementation Serialization
|
||||
|
||||
- (NSUInteger)currentLayer {
|
||||
return 129;
|
||||
return 131;
|
||||
}
|
||||
|
||||
- (id _Nullable)parseMessage:(NSData * _Nullable)data {
|
||||
|
@ -10,6 +10,8 @@
|
||||
#import <MtProtoKit/MTMessageTransaction.h>
|
||||
#import <MtProtoKit/MTDatacenterSaltInfo.h>
|
||||
#import <MtProtoKit/MTSessionInfo.h>
|
||||
#import <MtProtoKit/MTRpcError.h>
|
||||
#import <MtProtoKit/MTLogging.h>
|
||||
#import "MTInternalMessageParser.h"
|
||||
#import "MTRpcResultMessage.h"
|
||||
#import "MTBuffer.h"
|
||||
@ -143,6 +145,14 @@
|
||||
uint32_t signature = 0;
|
||||
[rpcResultMessage.data getBytes:&signature range:NSMakeRange(0, 4)];
|
||||
|
||||
id parsedMessage = [MTInternalMessageParser parseMessage:rpcResultMessage.data];
|
||||
if ([parsedMessage isKindOfClass:[MTRpcError class]]) {
|
||||
if (MTLogEnabled()) {
|
||||
MTRpcError *rpcError = (MTRpcError *)parsedMessage;
|
||||
MTLog(@"[MTRequestMessageService#%p response for %" PRId64 " is error: %d: %@]", self, _currentMessageId, (int)rpcError.errorCode, rpcError.errorDescription);
|
||||
}
|
||||
}
|
||||
|
||||
//boolTrue#997275b5 = Bool;
|
||||
if (signature == 0x997275b5U) {
|
||||
success = true;
|
||||
|
@ -162,10 +162,16 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable {
|
||||
self.id = Id(rawValue: Int64(bitPattern: idHighBits | idLowBits))
|
||||
}
|
||||
|
||||
assert(self.toInt64() == n)
|
||||
assert(self._toInt64() == n)
|
||||
}
|
||||
|
||||
public func toInt64() -> Int64 {
|
||||
let result = self._toInt64()
|
||||
assert(PeerId(result) == self)
|
||||
return result
|
||||
}
|
||||
|
||||
private func _toInt64() -> Int64 {
|
||||
let data = UInt64(bitPattern: self.id.rawValue)
|
||||
|
||||
let idLowBits = data & 0xffffffff
|
||||
@ -191,8 +197,6 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable {
|
||||
result = Int64(bitPattern: data)
|
||||
}
|
||||
|
||||
assert(PeerId(result) == self)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ public class BoxedMessage: NSObject {
|
||||
|
||||
public class Serialization: NSObject, MTSerialization {
|
||||
public func currentLayer() -> UInt {
|
||||
return 130
|
||||
return 131
|
||||
}
|
||||
|
||||
public func parseMessage(_ data: Data!) -> Any! {
|
||||
|
@ -551,7 +551,12 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
}
|
||||
|
||||
if self.activeAccountsValue!.primary == nil && self.activeAccountsValue!.currentAuth == nil {
|
||||
self.beginNewAuth(testingEnvironment: false)
|
||||
#if DEBUG
|
||||
let testingEnvironment = true
|
||||
#else
|
||||
let testingEnvironment = false
|
||||
#endif
|
||||
self.beginNewAuth(testingEnvironment: testingEnvironment)
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user