bug fixes

This commit is contained in:
Mike Renoir 2023-02-21 18:22:59 +04:00
parent 4dc2d8372d
commit 79cfa574b5
4 changed files with 17 additions and 23 deletions

View File

@ -55,7 +55,7 @@
@property (nonatomic) int32_t apiId;
@property (nonatomic, strong, readonly) NSString * _Nullable deviceModel;
@property (nonatomic, strong, readonly) NSDictionary<NSString *, NSString *> * _Nullable resolvedDeviceName;
@property (nonatomic, strong, readonly) NSString * _Nullable deviceModelName;
@property (nonatomic, strong, readonly) NSString * _Nullable systemVersion;
@property (nonatomic, strong) NSString * _Nullable appVersion;
@ -83,6 +83,6 @@
- (MTApiEnvironment * _Nonnull)withUpdatedNetworkSettings:(MTNetworkSettings * _Nullable)networkSettings;
- (MTApiEnvironment * _Nonnull)withUpdatedSystemCode:(NSData * _Nullable)systemCode;
-(id _Nonnull)initWithResolvedDeviceName:(NSDictionary<NSString *, NSString *> * _Nullable)resolvedDeviceName;
-(id _Nonnull)initWithDeviceModelName:(NSString * _Nullable)deviceModelName;
@end

View File

@ -428,7 +428,7 @@ static NSData *base64_decode(NSString *str) {
@implementation MTApiEnvironment
-(instancetype)init {
self = [self initWithResolvedDeviceName:nil];
self = [self initWithDeviceModelName:nil];
if (self != nil)
{
@ -436,22 +436,16 @@ static NSData *base64_decode(NSString *str) {
return self;
}
-(id _Nonnull)initWithResolvedDeviceName:(NSDictionary<NSString *, NSString *> * _Nullable)resolvedDeviceName {
-(id _Nonnull)initWithDeviceModelName:(NSString * _Nullable)deviceModelName {
self = [super init];
if (self != nil)
{
if (resolvedDeviceName != nil) {
NSString *model = [self platformString];
NSString* resolved = resolvedDeviceName[model];
if (resolved != nil) {
_deviceModel = resolved;
} else {
_deviceModel = model;
}
if (deviceModelName != nil) {
_deviceModel = deviceModelName;
} else {
_deviceModel = [self platformString];
}
_resolvedDeviceName = resolvedDeviceName;
_deviceModelName = deviceModelName;
#if TARGET_OS_IPHONE
_systemVersion = [[UIDevice currentDevice] systemVersion];
#else
@ -791,7 +785,7 @@ NSString *suffix = @"";
}
- (MTApiEnvironment *)withUpdatedLangPackCode:(NSString *)langPackCode {
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithResolvedDeviceName:_resolvedDeviceName];
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
result.apiId = self.apiId;
result.appVersion = self.appVersion;
@ -815,7 +809,7 @@ NSString *suffix = @"";
}
- (instancetype)copyWithZone:(NSZone *)__unused zone {
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithResolvedDeviceName:_resolvedDeviceName];
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
result.apiId = self.apiId;
result.appVersion = self.appVersion;
@ -839,7 +833,7 @@ NSString *suffix = @"";
}
- (MTApiEnvironment *)withUpdatedSocksProxySettings:(MTSocksProxySettings *)socksProxySettings {
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithResolvedDeviceName:_resolvedDeviceName];
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
result.apiId = self.apiId;
result.appVersion = self.appVersion;
@ -863,7 +857,7 @@ NSString *suffix = @"";
}
- (MTApiEnvironment *)withUpdatedNetworkSettings:(MTNetworkSettings *)networkSettings {
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithResolvedDeviceName:_resolvedDeviceName];
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
result.apiId = self.apiId;
result.appVersion = self.appVersion;
@ -887,7 +881,7 @@ NSString *suffix = @"";
}
- (MTApiEnvironment *)withUpdatedSystemCode:(NSData *)systemCode {
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithResolvedDeviceName:_resolvedDeviceName];
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithDeviceModelName:_deviceModelName];
result.apiId = self.apiId;
result.appVersion = self.appVersion;

View File

@ -432,8 +432,8 @@ public struct NetworkInitializationArguments {
public let appData: Signal<Data?, NoError>
public let autolockDeadine: Signal<Int32?, NoError>
public let encryptionProvider: EncryptionProvider
public let resolvedDeviceName:[String: String]?
public init(apiId: Int32, apiHash: String, languagesCategory: String, appVersion: String, voipMaxLayer: Int32, voipVersions: [CallSessionManagerImplementationVersion], appData: Signal<Data?, NoError>, autolockDeadine: Signal<Int32?, NoError>, encryptionProvider: EncryptionProvider, resolvedDeviceName:[String: String]?) {
public let deviceModelName:String?
public init(apiId: Int32, apiHash: String, languagesCategory: String, appVersion: String, voipMaxLayer: Int32, voipVersions: [CallSessionManagerImplementationVersion], appData: Signal<Data?, NoError>, autolockDeadine: Signal<Int32?, NoError>, encryptionProvider: EncryptionProvider, deviceModelName:String?) {
self.apiId = apiId
self.apiHash = apiHash
self.languagesCategory = languagesCategory
@ -443,7 +443,7 @@ public struct NetworkInitializationArguments {
self.appData = appData
self.autolockDeadine = autolockDeadine
self.encryptionProvider = encryptionProvider
self.resolvedDeviceName = resolvedDeviceName
self.deviceModelName = deviceModelName
}
}
#if os(iOS)
@ -458,7 +458,7 @@ func initializedNetwork(accountId: AccountRecordId, arguments: NetworkInitializa
let serialization = Serialization()
var apiEnvironment = MTApiEnvironment(resolvedDeviceName: arguments.resolvedDeviceName)
var apiEnvironment = MTApiEnvironment(deviceModelName: arguments.deviceModelName)
apiEnvironment.apiId = arguments.apiId
apiEnvironment.langPack = arguments.languagesCategory

View File

@ -370,7 +370,7 @@ func applyUpdateGroupMessages(postbox: Postbox, stateManager: AccountStateManage
mapping.append((message, MessageIndex(id: id, timestamp: storeMessage.timestamp), storeMessage))
}
} else {
assertionFailure()
// assertionFailure()
}
} else {
assertionFailure()