mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 19:30:29 +00:00
Fix parsing
This commit is contained in:
parent
deddf0dd0b
commit
34b3fe05e0
@ -66,10 +66,13 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let apiId: Int32 = BuildConfig.shared().apiId
|
let baseAppBundleId = String(appBundleIdentifier[..<lastDotRange.lowerBound])
|
||||||
|
|
||||||
|
let buildConfig = BuildConfig(baseAppBundleId: baseAppBundleId)
|
||||||
|
|
||||||
|
let apiId: Int32 = buildConfig.apiId
|
||||||
let languagesCategory = "ios"
|
let languagesCategory = "ios"
|
||||||
|
|
||||||
let baseAppBundleId = String(appBundleIdentifier[..<lastDotRange.lowerBound])
|
|
||||||
let appGroupName = "group.\(baseAppBundleId)"
|
let appGroupName = "group.\(baseAppBundleId)"
|
||||||
let maybeAppGroupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupName)
|
let maybeAppGroupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupName)
|
||||||
|
|
||||||
@ -101,7 +104,7 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
|
|||||||
})
|
})
|
||||||
semaphore.wait()
|
semaphore.wait()
|
||||||
|
|
||||||
let applicationBindings = TelegramApplicationBindings(isMainApp: false, containerPath: appGroupUrl.path, appSpecificScheme: BuildConfig.shared().appSpecificUrlScheme, openUrl: { _ in
|
let applicationBindings = TelegramApplicationBindings(isMainApp: false, containerPath: appGroupUrl.path, appSpecificScheme: buildConfig.appSpecificUrlScheme, openUrl: { _ in
|
||||||
}, openUniversalUrl: { _, completion in
|
}, openUniversalUrl: { _, completion in
|
||||||
completion.completion(false)
|
completion.completion(false)
|
||||||
return
|
return
|
||||||
@ -129,7 +132,7 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
|
|||||||
let deviceSpecificEncryptionParameters = BuildConfig.deviceSpecificEncryptionParameters(rootPath, baseAppBundleId: baseAppBundleId)
|
let deviceSpecificEncryptionParameters = BuildConfig.deviceSpecificEncryptionParameters(rootPath, baseAppBundleId: baseAppBundleId)
|
||||||
let encryptionParameters = ValueBoxEncryptionParameters(forceEncryptionIfNoSet: false, key: ValueBoxEncryptionParameters.Key(data: deviceSpecificEncryptionParameters.key)!, salt: ValueBoxEncryptionParameters.Salt(data: deviceSpecificEncryptionParameters.salt)!)
|
let encryptionParameters = ValueBoxEncryptionParameters(forceEncryptionIfNoSet: false, key: ValueBoxEncryptionParameters.Key(data: deviceSpecificEncryptionParameters.key)!, salt: ValueBoxEncryptionParameters.Salt(data: deviceSpecificEncryptionParameters.salt)!)
|
||||||
|
|
||||||
sharedAccountContext = SharedAccountContext(mainWindow: nil, basePath: rootPath, encryptionParameters: encryptionParameters, accountManager: accountManager, applicationBindings: applicationBindings, initialPresentationDataAndSettings: initialPresentationDataAndSettings!, networkArguments: NetworkInitializationArguments(apiId: apiId, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: 0, appData: BuildConfig.shared().bundleData), rootPath: rootPath, legacyBasePath: nil, legacyCache: nil, apsNotificationToken: .never(), voipNotificationToken: .never(), setNotificationCall: { _ in }, navigateToChat: { _, _, _ in })
|
sharedAccountContext = SharedAccountContext(mainWindow: nil, basePath: rootPath, encryptionParameters: encryptionParameters, accountManager: accountManager, applicationBindings: applicationBindings, initialPresentationDataAndSettings: initialPresentationDataAndSettings!, networkArguments: NetworkInitializationArguments(apiId: apiId, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: 0, appData: buildConfig.bundleData), rootPath: rootPath, legacyBasePath: nil, legacyCache: nil, apsNotificationToken: .never(), voipNotificationToken: .never(), setNotificationCall: { _ in }, navigateToChat: { _, _, _ in })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ private final class ParsedFile: NSObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fetchImageWithAccount(proxyConnection: AccountProxyConnection?, account: StoredAccountInfo, inputFileLocation: Api.InputFileLocation, datacenterId: Int32, completion: @escaping (Data?) -> Void) -> () -> Void {
|
func fetchImageWithAccount(buildConfig: BuildConfig, proxyConnection: AccountProxyConnection?, account: StoredAccountInfo, inputFileLocation: Api.InputFileLocation, datacenterId: Int32, completion: @escaping (Data?) -> Void) -> () -> Void {
|
||||||
MTLogSetEnabled(true)
|
MTLogSetEnabled(true)
|
||||||
MTLogSetLoggingFunction({ str, args in
|
MTLogSetLoggingFunction({ str, args in
|
||||||
//let string = NSString(format: str! as NSString, args!)
|
//let string = NSString(format: str! as NSString, args!)
|
||||||
@ -57,7 +57,7 @@ func fetchImageWithAccount(proxyConnection: AccountProxyConnection?, account: St
|
|||||||
|
|
||||||
var apiEnvironment = MTApiEnvironment()
|
var apiEnvironment = MTApiEnvironment()
|
||||||
|
|
||||||
apiEnvironment.apiId = BuildConfig.shared().apiId
|
apiEnvironment.apiId = buildConfig.apiId
|
||||||
apiEnvironment.langPack = "ios"
|
apiEnvironment.langPack = "ios"
|
||||||
apiEnvironment.layer = NSNumber(value: Int(serialization.currentLayer()))
|
apiEnvironment.layer = NSNumber(value: Int(serialization.currentLayer()))
|
||||||
apiEnvironment.disableUpdates = true
|
apiEnvironment.disableUpdates = true
|
||||||
|
|||||||
@ -461,7 +461,16 @@ class NotificationService: UNNotificationServiceExtension {
|
|||||||
contentHandler(bestAttemptContent)
|
contentHandler(bestAttemptContent)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.cancelFetch = fetchImageWithAccount(proxyConnection: accountInfos.proxy, account: account, inputFileLocation: inputFileLocation, datacenterId: datacenterId, completion: { [weak self] data in
|
let appBundleIdentifier = Bundle.main.bundleIdentifier!
|
||||||
|
guard let lastDotRange = appBundleIdentifier.range(of: ".", options: [.backwards]) else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let baseAppBundleId = String(appBundleIdentifier[..<lastDotRange.lowerBound])
|
||||||
|
|
||||||
|
let buildConfig = BuildConfig(baseAppBundleId: baseAppBundleId)
|
||||||
|
|
||||||
|
self.cancelFetch = fetchImageWithAccount(buildConfig: buildConfig, proxyConnection: accountInfos.proxy, account: account, inputFileLocation: inputFileLocation, datacenterId: datacenterId, completion: { [weak self] data in
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return
|
return
|
||||||
|
|||||||
@ -104,10 +104,13 @@ class ShareRootController: UIViewController {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let apiId: Int32 = BuildConfig.shared().apiId
|
let baseAppBundleId = String(appBundleIdentifier[..<lastDotRange.lowerBound])
|
||||||
|
|
||||||
|
let buildConfig = BuildConfig(baseAppBundleId: baseAppBundleId)
|
||||||
|
|
||||||
|
let apiId: Int32 = buildConfig.apiId
|
||||||
let languagesCategory = "ios"
|
let languagesCategory = "ios"
|
||||||
|
|
||||||
let baseAppBundleId = String(appBundleIdentifier[..<lastDotRange.lowerBound])
|
|
||||||
let appGroupName = "group.\(baseAppBundleId)"
|
let appGroupName = "group.\(baseAppBundleId)"
|
||||||
let maybeAppGroupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupName)
|
let maybeAppGroupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupName)
|
||||||
|
|
||||||
@ -125,7 +128,7 @@ class ShareRootController: UIViewController {
|
|||||||
|
|
||||||
setupSharedLogger(logsPath)
|
setupSharedLogger(logsPath)
|
||||||
|
|
||||||
let applicationBindings = TelegramApplicationBindings(isMainApp: false, containerPath: appGroupUrl.path, appSpecificScheme: BuildConfig.shared().appSpecificUrlScheme, openUrl: { _ in
|
let applicationBindings = TelegramApplicationBindings(isMainApp: false, containerPath: appGroupUrl.path, appSpecificScheme: buildConfig.appSpecificUrlScheme, openUrl: { _ in
|
||||||
}, openUniversalUrl: { _, completion in
|
}, openUniversalUrl: { _, completion in
|
||||||
completion.completion(false)
|
completion.completion(false)
|
||||||
return
|
return
|
||||||
@ -168,7 +171,7 @@ class ShareRootController: UIViewController {
|
|||||||
let deviceSpecificEncryptionParameters = BuildConfig.deviceSpecificEncryptionParameters(rootPath, baseAppBundleId: baseAppBundleId)
|
let deviceSpecificEncryptionParameters = BuildConfig.deviceSpecificEncryptionParameters(rootPath, baseAppBundleId: baseAppBundleId)
|
||||||
let encryptionParameters = ValueBoxEncryptionParameters(forceEncryptionIfNoSet: false, key: ValueBoxEncryptionParameters.Key(data: deviceSpecificEncryptionParameters.key)!, salt: ValueBoxEncryptionParameters.Salt(data: deviceSpecificEncryptionParameters.salt)!)
|
let encryptionParameters = ValueBoxEncryptionParameters(forceEncryptionIfNoSet: false, key: ValueBoxEncryptionParameters.Key(data: deviceSpecificEncryptionParameters.key)!, salt: ValueBoxEncryptionParameters.Salt(data: deviceSpecificEncryptionParameters.salt)!)
|
||||||
|
|
||||||
let sharedContext = SharedAccountContext(mainWindow: nil, basePath: rootPath, encryptionParameters: encryptionParameters, accountManager: accountManager, applicationBindings: applicationBindings, initialPresentationDataAndSettings: initialPresentationDataAndSettings!, networkArguments: NetworkInitializationArguments(apiId: apiId, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: 0, appData: BuildConfig.shared().bundleData), rootPath: rootPath, legacyBasePath: nil, legacyCache: nil, apsNotificationToken: .never(), voipNotificationToken: .never(), setNotificationCall: { _ in }, navigateToChat: { _, _, _ in })
|
let sharedContext = SharedAccountContext(mainWindow: nil, basePath: rootPath, encryptionParameters: encryptionParameters, accountManager: accountManager, applicationBindings: applicationBindings, initialPresentationDataAndSettings: initialPresentationDataAndSettings!, networkArguments: NetworkInitializationArguments(apiId: apiId, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: 0, appData: buildConfig.bundleData), rootPath: rootPath, legacyBasePath: nil, legacyCache: nil, apsNotificationToken: .never(), voipNotificationToken: .never(), setNotificationCall: { _ in }, navigateToChat: { _, _, _ in })
|
||||||
sharedExtensionContext = SharedExtensionContext(sharedContext: sharedContext)
|
sharedExtensionContext = SharedExtensionContext(sharedContext: sharedContext)
|
||||||
globalSharedExtensionContext = sharedExtensionContext
|
globalSharedExtensionContext = sharedExtensionContext
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,10 +55,13 @@ class IntentHandler: INExtension, INSendMessageIntentHandling, INSearchForMessag
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let apiId: Int32 = BuildConfig.shared().apiId
|
let baseAppBundleId = String(appBundleIdentifier[..<lastDotRange.lowerBound])
|
||||||
|
|
||||||
|
let buildConfig = BuildConfig(baseAppBundleId: baseAppBundleId)
|
||||||
|
|
||||||
|
let apiId: Int32 = buildConfig.apiId
|
||||||
let languagesCategory = "ios"
|
let languagesCategory = "ios"
|
||||||
|
|
||||||
let baseAppBundleId = String(appBundleIdentifier[..<lastDotRange.lowerBound])
|
|
||||||
let appGroupName = "group.\(baseAppBundleId)"
|
let appGroupName = "group.\(baseAppBundleId)"
|
||||||
let maybeAppGroupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupName)
|
let maybeAppGroupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupName)
|
||||||
|
|
||||||
@ -88,7 +91,7 @@ class IntentHandler: INExtension, INSendMessageIntentHandling, INSearchForMessag
|
|||||||
let deviceSpecificEncryptionParameters = BuildConfig.deviceSpecificEncryptionParameters(rootPath, baseAppBundleId: baseAppBundleId)
|
let deviceSpecificEncryptionParameters = BuildConfig.deviceSpecificEncryptionParameters(rootPath, baseAppBundleId: baseAppBundleId)
|
||||||
let encryptionParameters = ValueBoxEncryptionParameters(forceEncryptionIfNoSet: false, key: ValueBoxEncryptionParameters.Key(data: deviceSpecificEncryptionParameters.key)!, salt: ValueBoxEncryptionParameters.Salt(data: deviceSpecificEncryptionParameters.salt)!)
|
let encryptionParameters = ValueBoxEncryptionParameters(forceEncryptionIfNoSet: false, key: ValueBoxEncryptionParameters.Key(data: deviceSpecificEncryptionParameters.key)!, salt: ValueBoxEncryptionParameters.Salt(data: deviceSpecificEncryptionParameters.salt)!)
|
||||||
|
|
||||||
account = currentAccount(allocateIfNotExists: false, networkArguments: NetworkInitializationArguments(apiId: apiId, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: 0, appData: BuildConfig.shared().bundleData), supplementary: true, manager: accountManager, rootPath: rootPath, auxiliaryMethods: accountAuxiliaryMethods, encryptionParameters: encryptionParameters)
|
account = currentAccount(allocateIfNotExists: false, networkArguments: NetworkInitializationArguments(apiId: apiId, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: 0, appData: buildConfig.bundleData), supplementary: true, manager: accountManager, rootPath: rootPath, auxiliaryMethods: accountAuxiliaryMethods, encryptionParameters: encryptionParameters)
|
||||||
|> mapToSignal { account -> Signal<Account, NoError> in
|
|> mapToSignal { account -> Signal<Account, NoError> in
|
||||||
if let account = account {
|
if let account = account {
|
||||||
switch account {
|
switch account {
|
||||||
|
|||||||
@ -346,17 +346,19 @@ final class SharedApplicationContext {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
let apiId: Int32 = BuildConfig.shared().apiId
|
|
||||||
let languagesCategory = "ios"
|
|
||||||
|
|
||||||
let appVersion = (Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String) ?? "unknown"
|
let appVersion = (Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String) ?? "unknown"
|
||||||
|
|
||||||
let networkArguments = NetworkInitializationArguments(apiId: apiId, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: PresentationCallManager.voipMaxLayer, appData: BuildConfig.shared().bundleData)
|
|
||||||
|
|
||||||
let baseAppBundleId = Bundle.main.bundleIdentifier!
|
let baseAppBundleId = Bundle.main.bundleIdentifier!
|
||||||
let appGroupName = "group.\(baseAppBundleId)"
|
let appGroupName = "group.\(baseAppBundleId)"
|
||||||
let maybeAppGroupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupName)
|
let maybeAppGroupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupName)
|
||||||
|
|
||||||
|
let buildConfig = BuildConfig(baseAppBundleId: baseAppBundleId)
|
||||||
|
|
||||||
|
let apiId: Int32 = buildConfig.apiId
|
||||||
|
let languagesCategory = "ios"
|
||||||
|
|
||||||
|
let networkArguments = NetworkInitializationArguments(apiId: apiId, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: PresentationCallManager.voipMaxLayer, appData: buildConfig.bundleData)
|
||||||
|
|
||||||
guard let appGroupUrl = maybeAppGroupUrl else {
|
guard let appGroupUrl = maybeAppGroupUrl else {
|
||||||
UIAlertView(title: nil, message: "Error 2", delegate: nil, cancelButtonTitle: "OK").show()
|
UIAlertView(title: nil, message: "Error 2", delegate: nil, cancelButtonTitle: "OK").show()
|
||||||
return true
|
return true
|
||||||
@ -371,7 +373,7 @@ final class SharedApplicationContext {
|
|||||||
isDebugConfiguration = true
|
isDebugConfiguration = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if isDebugConfiguration || BuildConfig.shared().isInternalBuild {
|
if isDebugConfiguration || buildConfig.isInternalBuild {
|
||||||
LoggingSettings.defaultSettings = LoggingSettings(logToFile: true, logToConsole: false, redactSensitiveData: true)
|
LoggingSettings.defaultSettings = LoggingSettings(logToFile: true, logToConsole: false, redactSensitiveData: true)
|
||||||
} else {
|
} else {
|
||||||
LoggingSettings.defaultSettings = LoggingSettings(logToFile: false, logToConsole: false, redactSensitiveData: true)
|
LoggingSettings.defaultSettings = LoggingSettings(logToFile: false, logToConsole: false, redactSensitiveData: true)
|
||||||
@ -428,7 +430,7 @@ final class SharedApplicationContext {
|
|||||||
|
|
||||||
telegramUIDeclareEncodables()
|
telegramUIDeclareEncodables()
|
||||||
|
|
||||||
GlobalExperimentalSettings.isAppStoreBuild = BuildConfig.shared().isAppStoreBuild
|
GlobalExperimentalSettings.isAppStoreBuild = buildConfig.isAppStoreBuild
|
||||||
|
|
||||||
GlobalExperimentalSettings.enableFeed = false
|
GlobalExperimentalSettings.enableFeed = false
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
@ -444,7 +446,7 @@ final class SharedApplicationContext {
|
|||||||
|
|
||||||
initializeAccountManagement()
|
initializeAccountManagement()
|
||||||
|
|
||||||
let applicationBindings = TelegramApplicationBindings(isMainApp: true, containerPath: appGroupUrl.path, appSpecificScheme: BuildConfig.shared().appSpecificUrlScheme, openUrl: { url in
|
let applicationBindings = TelegramApplicationBindings(isMainApp: true, containerPath: appGroupUrl.path, appSpecificScheme: buildConfig.appSpecificUrlScheme, openUrl: { url in
|
||||||
var parsedUrl = URL(string: url)
|
var parsedUrl = URL(string: url)
|
||||||
if let parsed = parsedUrl {
|
if let parsed = parsedUrl {
|
||||||
if parsed.scheme == nil || parsed.scheme!.isEmpty {
|
if parsed.scheme == nil || parsed.scheme!.isEmpty {
|
||||||
@ -537,7 +539,7 @@ final class SharedApplicationContext {
|
|||||||
UIApplication.shared.openURL(url)
|
UIApplication.shared.openURL(url)
|
||||||
}
|
}
|
||||||
}, openAppStorePage: {
|
}, openAppStorePage: {
|
||||||
let appStoreId = BuildConfig.shared().appStoreId
|
let appStoreId = buildConfig.appStoreId
|
||||||
if let url = URL(string: "itms-apps://itunes.apple.com/app/id\(appStoreId)") {
|
if let url = URL(string: "itms-apps://itunes.apple.com/app/id\(appStoreId)") {
|
||||||
UIApplication.shared.openURL(url)
|
UIApplication.shared.openURL(url)
|
||||||
}
|
}
|
||||||
@ -936,7 +938,7 @@ final class SharedApplicationContext {
|
|||||||
|> deliverOnMainQueue
|
|> deliverOnMainQueue
|
||||||
|> map { accountAndSettings -> UnauthorizedApplicationContext? in
|
|> map { accountAndSettings -> UnauthorizedApplicationContext? in
|
||||||
return accountAndSettings.flatMap { account, limitsConfiguration, callListSettings, otherAccountPhoneNumbers in
|
return accountAndSettings.flatMap { account, limitsConfiguration, callListSettings, otherAccountPhoneNumbers in
|
||||||
return UnauthorizedApplicationContext(sharedContext: sharedApplicationContext.sharedContext, account: account, otherAccountPhoneNumbers: otherAccountPhoneNumbers)
|
return UnauthorizedApplicationContext(buildConfig: buildConfig, sharedContext: sharedApplicationContext.sharedContext, account: account, otherAccountPhoneNumbers: otherAccountPhoneNumbers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1157,7 +1159,7 @@ final class SharedApplicationContext {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if let hockeyAppId = BuildConfig.shared().hockeyAppId, !hockeyAppId.isEmpty {
|
if let hockeyAppId = buildConfig.hockeyAppId, !hockeyAppId.isEmpty {
|
||||||
BITHockeyManager.shared().configure(withIdentifier: hockeyAppId, delegate: self)
|
BITHockeyManager.shared().configure(withIdentifier: hockeyAppId, delegate: self)
|
||||||
BITHockeyManager.shared().crashManager.crashManagerStatus = .alwaysAsk
|
BITHockeyManager.shared().crashManager.crashManagerStatus = .alwaysAsk
|
||||||
BITHockeyManager.shared().start()
|
BITHockeyManager.shared().start()
|
||||||
|
|||||||
@ -21,12 +21,12 @@ final class UnauthorizedApplicationContext {
|
|||||||
|
|
||||||
let rootController: AuthorizationSequenceController
|
let rootController: AuthorizationSequenceController
|
||||||
|
|
||||||
init(sharedContext: SharedAccountContext, account: UnauthorizedAccount, otherAccountPhoneNumbers: ((String, AccountRecordId, Bool)?, [(String, AccountRecordId, Bool)])) {
|
init(buildConfig: BuildConfig, sharedContext: SharedAccountContext, account: UnauthorizedAccount, otherAccountPhoneNumbers: ((String, AccountRecordId, Bool)?, [(String, AccountRecordId, Bool)])) {
|
||||||
self.sharedContext = sharedContext
|
self.sharedContext = sharedContext
|
||||||
self.account = account
|
self.account = account
|
||||||
let presentationData = sharedContext.currentPresentationData.with { $0 }
|
let presentationData = sharedContext.currentPresentationData.with { $0 }
|
||||||
|
|
||||||
self.rootController = AuthorizationSequenceController(sharedContext: sharedContext, account: account, otherAccountPhoneNumbers: otherAccountPhoneNumbers, strings: presentationData.strings, theme: presentationData.theme, openUrl: sharedContext.applicationBindings.openUrl, apiId: BuildConfig.shared().apiId, apiHash: BuildConfig.shared().apiHash)
|
self.rootController = AuthorizationSequenceController(sharedContext: sharedContext, account: account, otherAccountPhoneNumbers: otherAccountPhoneNumbers, strings: presentationData.strings, theme: presentationData.theme, openUrl: sharedContext.applicationBindings.openUrl, apiId: buildConfig.apiId, apiHash: buildConfig.apiHash)
|
||||||
|
|
||||||
account.shouldBeServiceTaskMaster.set(sharedContext.applicationBindings.applicationInForeground |> map { value -> AccountServiceTaskMasterMode in
|
account.shouldBeServiceTaskMaster.set(sharedContext.applicationBindings.applicationInForeground |> map { value -> AccountServiceTaskMasterMode in
|
||||||
if value {
|
if value {
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
@interface BuildConfig : NSObject
|
@interface BuildConfig : NSObject
|
||||||
|
|
||||||
+ (instancetype _Nonnull)sharedBuildConfig;
|
- (instancetype _Nonnull)initWithBaseAppBundleId:(NSString * _Nonnull)baseAppBundleId;
|
||||||
|
|
||||||
@property (nonatomic, strong, readonly) NSData * _Nullable bundleData;
|
@property (nonatomic, strong, readonly) NSData * _Nullable bundleData;
|
||||||
@property (nonatomic, strong, readonly) NSString * _Nullable hockeyAppId;
|
@property (nonatomic, strong, readonly) NSString * _Nullable hockeyAppId;
|
||||||
|
|||||||
@ -339,20 +339,18 @@ API_AVAILABLE(ios(10))
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype _Nonnull)initWithBaseAppBundleId:(NSString * _Nonnull)baseAppBundleId {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_apiId = APP_CONFIG_API_ID;
|
_apiId = APP_CONFIG_API_ID;
|
||||||
_apiHash = @(APP_CONFIG_API_HASH);
|
_apiHash = @(APP_CONFIG_API_HASH);
|
||||||
_hockeyAppId = @(APP_CONFIG_HOCKEYAPP_ID);
|
_hockeyAppId = @(APP_CONFIG_HOCKEYAPP_ID);
|
||||||
|
|
||||||
NSString *bundleId = [NSBundle mainBundle].bundleIdentifier;
|
|
||||||
|
|
||||||
MTPKCS *signature = checkSignature([[[NSBundle mainBundle] executablePath] UTF8String]);
|
MTPKCS *signature = checkSignature([[[NSBundle mainBundle] executablePath] UTF8String]);
|
||||||
NSMutableDictionary *dataDict = [[NSMutableDictionary alloc] init];
|
NSMutableDictionary *dataDict = [[NSMutableDictionary alloc] init];
|
||||||
|
|
||||||
if (bundleId != nil) {
|
if (baseAppBundleId != nil) {
|
||||||
dataDict[@"bundleId"] = bundleId;
|
dataDict[@"bundleId"] = baseAppBundleId;
|
||||||
}
|
}
|
||||||
if (signature.name != nil) {
|
if (signature.name != nil) {
|
||||||
dataDict[@"name"] = signature.name;
|
dataDict[@"name"] = signature.name;
|
||||||
|
|||||||
@ -27,6 +27,7 @@ class TodayViewController: UIViewController, NCWidgetProviding {
|
|||||||
private var initializedInterface = false
|
private var initializedInterface = false
|
||||||
|
|
||||||
private let disposable = MetaDisposable()
|
private let disposable = MetaDisposable()
|
||||||
|
private var buildConfig: BuildConfig?
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
self.disposable.dispose()
|
self.disposable.dispose()
|
||||||
@ -53,11 +54,14 @@ class TodayViewController: UIViewController, NCWidgetProviding {
|
|||||||
guard let lastDotRange = appBundleIdentifier.range(of: ".", options: [.backwards]) else {
|
guard let lastDotRange = appBundleIdentifier.range(of: ".", options: [.backwards]) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
let baseAppBundleId = String(appBundleIdentifier[..<lastDotRange.lowerBound])
|
||||||
|
|
||||||
let apiId: Int32 = BuildConfig.shared().apiId
|
let buildConfig = BuildConfig(baseAppBundleId: baseAppBundleId)
|
||||||
|
self.buildConfig = buildConfig
|
||||||
|
|
||||||
|
let apiId: Int32 = buildConfig.apiId
|
||||||
let languagesCategory = "ios"
|
let languagesCategory = "ios"
|
||||||
|
|
||||||
let baseAppBundleId = String(appBundleIdentifier[..<lastDotRange.lowerBound])
|
|
||||||
let appGroupName = "group.\(baseAppBundleId)"
|
let appGroupName = "group.\(baseAppBundleId)"
|
||||||
let maybeAppGroupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupName)
|
let maybeAppGroupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupName)
|
||||||
|
|
||||||
@ -83,7 +87,7 @@ class TodayViewController: UIViewController, NCWidgetProviding {
|
|||||||
let deviceSpecificEncryptionParameters = BuildConfig.deviceSpecificEncryptionParameters(rootPath, baseAppBundleId: baseAppBundleId)
|
let deviceSpecificEncryptionParameters = BuildConfig.deviceSpecificEncryptionParameters(rootPath, baseAppBundleId: baseAppBundleId)
|
||||||
let encryptionParameters = ValueBoxEncryptionParameters(forceEncryptionIfNoSet: false, key: ValueBoxEncryptionParameters.Key(data: deviceSpecificEncryptionParameters.key)!, salt: ValueBoxEncryptionParameters.Salt(data: deviceSpecificEncryptionParameters.salt)!)
|
let encryptionParameters = ValueBoxEncryptionParameters(forceEncryptionIfNoSet: false, key: ValueBoxEncryptionParameters.Key(data: deviceSpecificEncryptionParameters.key)!, salt: ValueBoxEncryptionParameters.Salt(data: deviceSpecificEncryptionParameters.salt)!)
|
||||||
|
|
||||||
account = currentAccount(allocateIfNotExists: false, networkArguments: NetworkInitializationArguments(apiId: apiId, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: 0, appData: BuildConfig.shared().bundleData), supplementary: true, manager: accountManager, rootPath: rootPath, auxiliaryMethods: auxiliaryMethods, encryptionParameters: encryptionParameters)
|
account = currentAccount(allocateIfNotExists: false, networkArguments: NetworkInitializationArguments(apiId: apiId, languagesCategory: languagesCategory, appVersion: appVersion, voipMaxLayer: 0, appData: buildConfig.bundleData), supplementary: true, manager: accountManager, rootPath: rootPath, auxiliaryMethods: auxiliaryMethods, encryptionParameters: encryptionParameters)
|
||||||
|> mapToSignal { account -> Signal<Account, NoError> in
|
|> mapToSignal { account -> Signal<Account, NoError> in
|
||||||
if let account = account {
|
if let account = account {
|
||||||
switch account {
|
switch account {
|
||||||
@ -137,8 +141,8 @@ class TodayViewController: UIViewController, NCWidgetProviding {
|
|||||||
self.peerViews = []
|
self.peerViews = []
|
||||||
for peer in peers {
|
for peer in peers {
|
||||||
let peerView = PeerView(account: account, peer: peer, tapped: { [weak self] in
|
let peerView = PeerView(account: account, peer: peer, tapped: { [weak self] in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self, let buildConfig = strongSelf.buildConfig {
|
||||||
if let url = URL(string: "\(BuildConfig.shared().appSpecificUrlScheme)://localpeer?id=\(peer.id.toInt64())") {
|
if let url = URL(string: "\(buildConfig.appSpecificUrlScheme)://localpeer?id=\(peer.id.toInt64())") {
|
||||||
strongSelf.extensionContext?.open(url, completionHandler: nil)
|
strongSelf.extensionContext?.open(url, completionHandler: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user