mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
- custom deviceModel name can be transffered from UI
This commit is contained in:
parent
6f082b3e93
commit
09a679cbdd
@ -55,6 +55,8 @@
|
|||||||
|
|
||||||
@property (nonatomic) int32_t apiId;
|
@property (nonatomic) int32_t apiId;
|
||||||
@property (nonatomic, strong, readonly) NSString * _Nullable deviceModel;
|
@property (nonatomic, strong, readonly) NSString * _Nullable deviceModel;
|
||||||
|
@property (nonatomic, strong, readonly) NSDictionary<NSString *, NSString *> * _Nullable resolvedPlatformName;
|
||||||
|
|
||||||
@property (nonatomic, strong, readonly) NSString * _Nullable systemVersion;
|
@property (nonatomic, strong, readonly) NSString * _Nullable systemVersion;
|
||||||
@property (nonatomic, strong) NSString * _Nullable appVersion;
|
@property (nonatomic, strong) NSString * _Nullable appVersion;
|
||||||
@property (nonatomic, strong, readonly) NSString * _Nullable systemLangCode;
|
@property (nonatomic, strong, readonly) NSString * _Nullable systemLangCode;
|
||||||
@ -81,4 +83,6 @@
|
|||||||
- (MTApiEnvironment * _Nonnull)withUpdatedNetworkSettings:(MTNetworkSettings * _Nullable)networkSettings;
|
- (MTApiEnvironment * _Nonnull)withUpdatedNetworkSettings:(MTNetworkSettings * _Nullable)networkSettings;
|
||||||
- (MTApiEnvironment * _Nonnull)withUpdatedSystemCode:(NSData * _Nullable)systemCode;
|
- (MTApiEnvironment * _Nonnull)withUpdatedSystemCode:(NSData * _Nullable)systemCode;
|
||||||
|
|
||||||
|
-(id _Nonnull)initWithResolvedPlatformName:(NSDictionary<NSString *, NSString *> * _Nullable)resolvedPlatformName;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -427,12 +427,31 @@ static NSData *base64_decode(NSString *str) {
|
|||||||
|
|
||||||
@implementation MTApiEnvironment
|
@implementation MTApiEnvironment
|
||||||
|
|
||||||
- (instancetype)init
|
-(instancetype)init {
|
||||||
|
self = [self initWithResolvedPlatformName:nil];
|
||||||
|
if (self != nil)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
-(id _Nonnull)initWithResolvedPlatformName:(NSDictionary<NSString *, NSString *> * _Nullable)resolvedPlatformName {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
{
|
{
|
||||||
|
if (resolvedPlatformName != nil) {
|
||||||
|
NSString *model = [self platformString];
|
||||||
|
NSString* resolved = resolvedPlatformName[model];
|
||||||
|
if (resolved != nil) {
|
||||||
|
_deviceModel = resolved;
|
||||||
|
} else {
|
||||||
|
_deviceModel = model;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
_deviceModel = [self platformString];
|
_deviceModel = [self platformString];
|
||||||
|
}
|
||||||
|
_resolvedPlatformName = resolvedPlatformName;
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
_systemVersion = [[UIDevice currentDevice] systemVersion];
|
_systemVersion = [[UIDevice currentDevice] systemVersion];
|
||||||
#else
|
#else
|
||||||
@ -759,7 +778,7 @@ NSString *suffix = @"";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (MTApiEnvironment *)withUpdatedLangPackCode:(NSString *)langPackCode {
|
- (MTApiEnvironment *)withUpdatedLangPackCode:(NSString *)langPackCode {
|
||||||
MTApiEnvironment *result = [[MTApiEnvironment alloc] init];
|
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithResolvedPlatformName:_resolvedPlatformName];
|
||||||
|
|
||||||
result.apiId = self.apiId;
|
result.apiId = self.apiId;
|
||||||
result.appVersion = self.appVersion;
|
result.appVersion = self.appVersion;
|
||||||
@ -783,7 +802,7 @@ NSString *suffix = @"";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)copyWithZone:(NSZone *)__unused zone {
|
- (instancetype)copyWithZone:(NSZone *)__unused zone {
|
||||||
MTApiEnvironment *result = [[MTApiEnvironment alloc] init];
|
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithResolvedPlatformName:_resolvedPlatformName];
|
||||||
|
|
||||||
result.apiId = self.apiId;
|
result.apiId = self.apiId;
|
||||||
result.appVersion = self.appVersion;
|
result.appVersion = self.appVersion;
|
||||||
@ -807,7 +826,7 @@ NSString *suffix = @"";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (MTApiEnvironment *)withUpdatedSocksProxySettings:(MTSocksProxySettings *)socksProxySettings {
|
- (MTApiEnvironment *)withUpdatedSocksProxySettings:(MTSocksProxySettings *)socksProxySettings {
|
||||||
MTApiEnvironment *result = [[MTApiEnvironment alloc] init];
|
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithResolvedPlatformName:_resolvedPlatformName];
|
||||||
|
|
||||||
result.apiId = self.apiId;
|
result.apiId = self.apiId;
|
||||||
result.appVersion = self.appVersion;
|
result.appVersion = self.appVersion;
|
||||||
@ -831,7 +850,7 @@ NSString *suffix = @"";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (MTApiEnvironment *)withUpdatedNetworkSettings:(MTNetworkSettings *)networkSettings {
|
- (MTApiEnvironment *)withUpdatedNetworkSettings:(MTNetworkSettings *)networkSettings {
|
||||||
MTApiEnvironment *result = [[MTApiEnvironment alloc] init];
|
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithResolvedPlatformName:_resolvedPlatformName];
|
||||||
|
|
||||||
result.apiId = self.apiId;
|
result.apiId = self.apiId;
|
||||||
result.appVersion = self.appVersion;
|
result.appVersion = self.appVersion;
|
||||||
@ -855,7 +874,7 @@ NSString *suffix = @"";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (MTApiEnvironment *)withUpdatedSystemCode:(NSData *)systemCode {
|
- (MTApiEnvironment *)withUpdatedSystemCode:(NSData *)systemCode {
|
||||||
MTApiEnvironment *result = [[MTApiEnvironment alloc] init];
|
MTApiEnvironment *result = [[MTApiEnvironment alloc] initWithResolvedPlatformName:_resolvedPlatformName];
|
||||||
|
|
||||||
result.apiId = self.apiId;
|
result.apiId = self.apiId;
|
||||||
result.appVersion = self.appVersion;
|
result.appVersion = self.appVersion;
|
||||||
|
@ -406,8 +406,8 @@ public struct NetworkInitializationArguments {
|
|||||||
public let appData: Signal<Data?, NoError>
|
public let appData: Signal<Data?, NoError>
|
||||||
public let autolockDeadine: Signal<Int32?, NoError>
|
public let autolockDeadine: Signal<Int32?, NoError>
|
||||||
public let encryptionProvider: EncryptionProvider
|
public let encryptionProvider: EncryptionProvider
|
||||||
|
public let resolvedPlatformName:[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) {
|
public init(apiId: Int32, apiHash: String, languagesCategory: String, appVersion: String, voipMaxLayer: Int32, voipVersions: [CallSessionManagerImplementationVersion], appData: Signal<Data?, NoError>, autolockDeadine: Signal<Int32?, NoError>, encryptionProvider: EncryptionProvider, resolvedPlatformName:[String: String]?) {
|
||||||
self.apiId = apiId
|
self.apiId = apiId
|
||||||
self.apiHash = apiHash
|
self.apiHash = apiHash
|
||||||
self.languagesCategory = languagesCategory
|
self.languagesCategory = languagesCategory
|
||||||
@ -417,6 +417,7 @@ public struct NetworkInitializationArguments {
|
|||||||
self.appData = appData
|
self.appData = appData
|
||||||
self.autolockDeadine = autolockDeadine
|
self.autolockDeadine = autolockDeadine
|
||||||
self.encryptionProvider = encryptionProvider
|
self.encryptionProvider = encryptionProvider
|
||||||
|
self.resolvedPlatformName = resolvedPlatformName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
@ -431,7 +432,7 @@ func initializedNetwork(accountId: AccountRecordId, arguments: NetworkInitializa
|
|||||||
|
|
||||||
let serialization = Serialization()
|
let serialization = Serialization()
|
||||||
|
|
||||||
var apiEnvironment = MTApiEnvironment()
|
var apiEnvironment = MTApiEnvironment(resolvedPlatformName: arguments.resolvedPlatformName)
|
||||||
|
|
||||||
apiEnvironment.apiId = arguments.apiId
|
apiEnvironment.apiId = arguments.apiId
|
||||||
apiEnvironment.langPack = arguments.languagesCategory
|
apiEnvironment.langPack = arguments.languagesCategory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user