Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2021-10-27 19:57:56 +04:00
commit 2551584941
3 changed files with 126 additions and 201 deletions

View File

@ -1 +1 @@
2bf91df86de591d993771f62fd05896852285001a5e720b8b04158a855350de3 64cebdba7735cac7dfdaecc3c534bfe01dfd3a7cc6f3a084fac71a5728209932

View File

@ -638,14 +638,14 @@ final class SharedApplicationContext {
}, getAvailableAlternateIcons: { }, getAvailableAlternateIcons: {
if #available(iOS 10.3, *) { if #available(iOS 10.3, *) {
var icons = [ var icons = [
PresentationAppIcon(name: "Blue", imageName: "BlueIcon", isDefault: buildConfig.isAppStoreBuild), PresentationAppIcon(name: "BlueIcon", imageName: "BlueIcon", isDefault: buildConfig.isAppStoreBuild),
PresentationAppIcon(name: "New2", imageName: "New2"), PresentationAppIcon(name: "New2", imageName: "New2"),
PresentationAppIcon(name: "New1", imageName: "New1"), PresentationAppIcon(name: "New1", imageName: "New1"),
PresentationAppIcon(name: "Black", imageName: "BlackIcon"), PresentationAppIcon(name: "BlackIcon", imageName: "BlackIcon"),
PresentationAppIcon(name: "BlueClassic", imageName: "BlueClassicIcon"), PresentationAppIcon(name: "BlueClassicIcon", imageName: "BlueClassicIcon"),
PresentationAppIcon(name: "BlackClassic", imageName: "BlackClassicIcon"), PresentationAppIcon(name: "BlackClassicIcon", imageName: "BlackClassicIcon"),
PresentationAppIcon(name: "BlueFilled", imageName: "BlueFilledIcon"), PresentationAppIcon(name: "BlueFilledIcon", imageName: "BlueFilledIcon"),
PresentationAppIcon(name: "BlackFilled", imageName: "BlackFilledIcon") PresentationAppIcon(name: "BlackFilledIcon", imageName: "BlackFilledIcon")
] ]
if buildConfig.isInternalBuild { if buildConfig.isInternalBuild {
icons.append(PresentationAppIcon(name: "WhiteFilled", imageName: "WhiteFilledIcon")) icons.append(PresentationAppIcon(name: "WhiteFilled", imageName: "WhiteFilledIcon"))
@ -701,70 +701,6 @@ final class SharedApplicationContext {
}) })
} }
#if ENABLE_WALLET
let tonKeychain: TonKeychain
#if targetEnvironment(simulator)
tonKeychain = TonKeychain(encryptionPublicKey: {
//return .single(nil)
//return .single("1".data(using: .utf8)!)
return .single(Data())
}, encrypt: { data in
return Signal { subscriber in
subscriber.putNext(TonKeychainEncryptedData(publicKey: Data(), data: data))
subscriber.putCompletion()
return EmptyDisposable
}
}, decrypt: { data in
return Signal { subscriber in
subscriber.putNext(data.data)
subscriber.putCompletion()
return EmptyDisposable
}
})
#else
tonKeychain = TonKeychain(encryptionPublicKey: {
return Signal { subscriber in
BuildConfig.getHardwareEncryptionAvailable(withBaseAppBundleId: baseAppBundleId, completion: { value in
subscriber.putNext(value)
subscriber.putCompletion()
})
return EmptyDisposable
}
}, encrypt: { data in
return Signal { subscriber in
BuildConfig.encryptApplicationSecret(data, baseAppBundleId: baseAppBundleId, completion: { result, publicKey in
if let result = result, let publicKey = publicKey {
subscriber.putNext(TonKeychainEncryptedData(publicKey: publicKey, data: result))
subscriber.putCompletion()
} else {
subscriber.putError(.generic)
}
})
return EmptyDisposable
}
}, decrypt: { encryptedData in
return Signal { subscriber in
BuildConfig.decryptApplicationSecret(encryptedData.data, publicKey: encryptedData.publicKey, baseAppBundleId: baseAppBundleId, completion: { result, cancelled in
if let result = result {
subscriber.putNext(result)
} else {
let error: TonKeychainDecryptDataError
if cancelled {
error = .cancelled
} else {
error = .generic
}
subscriber.putError(error)
}
subscriber.putCompletion()
})
return EmptyDisposable
}
})
#endif
#endif
let sharedContextSignal = accountManagerSignal let sharedContextSignal = accountManagerSignal
|> deliverOnMainQueue |> deliverOnMainQueue
|> take(1) |> take(1)
@ -816,15 +752,6 @@ final class SharedApplicationContext {
} }
}) })
/*self.mainWindow.debugAction = {
self.mainWindow.debugAction = nil
let presentationData = sharedContext.currentPresentationData.with { $0 }
let navigationController = NavigationController(mode: .single, theme: NavigationControllerTheme(presentationTheme: presentationData.theme))
navigationController.viewControllers = [debugController(sharedContext: sharedContext, context: nil)]
self.mainWindow.present(navigationController, on: .root)
}*/
presentationDataPromise.set(sharedContext.presentationData) presentationDataPromise.set(sharedContext.presentationData)
let rawAccounts = sharedContext.activeAccountContexts let rawAccounts = sharedContext.activeAccountContexts
@ -1490,7 +1417,6 @@ final class SharedApplicationContext {
} }
public func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) { public func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) {
if #available(iOS 9.0, *) {
/*guard var encryptedPayload = payload.dictionaryPayload["p"] as? String else { /*guard var encryptedPayload = payload.dictionaryPayload["p"] as? String else {
return return
} }
@ -1615,7 +1541,6 @@ final class SharedApplicationContext {
} }
}) })
} }
}
public func pushRegistry(_ registry: PKPushRegistry, didInvalidatePushTokenFor type: PKPushType) { public func pushRegistry(_ registry: PKPushRegistry, didInvalidatePushTokenFor type: PKPushType) {
Logger.shared.log("App \(self.episodeId)", "invalidated token for \(type)") Logger.shared.log("App \(self.episodeId)", "invalidated token for \(type)")

View File

@ -614,7 +614,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
updatedFetchControls = FetchControls(fetch: { manual in updatedFetchControls = FetchControls(fetch: { manual in
if let strongSelf = self { if let strongSelf = self {
if let representation = largestRepresentationForPhoto(image) { if let representation = largestRepresentationForPhoto(image) {
strongSelf.fetchDisposable.set(messageMediaImageInteractiveFetched(context: context, message: message, image: image, resource: representation.resource, range: representationFetchRangeForDisplayAtSize(representation: representation, dimension: isSecretMedia ? nil : 600), userInitiated: manual, storeToDownloadsPeerType: storeToDownloadsPeerType).start()) strongSelf.fetchDisposable.set(messageMediaImageInteractiveFetched(context: context, message: message, image: image, resource: representation.resource, range: representationFetchRangeForDisplayAtSize(representation: representation, dimension: nil/*isSecretMedia ? nil : 600*/), userInitiated: manual, storeToDownloadsPeerType: storeToDownloadsPeerType).start())
} }
} }
}, cancel: { }, cancel: {