From 5a84384da7a3f7ff06183d6acc8c970996e7383e Mon Sep 17 00:00:00 2001 From: Peter <> Date: Mon, 22 Apr 2019 17:24:13 +0400 Subject: [PATCH] Allow creating inputDocumentFileLocation with an empty fileReference (stickers in secret chats) --- TelegramCore/ChatHistoryPreloadManager.swift | 2 -- TelegramCore/CloudFileMediaResource.swift | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/TelegramCore/ChatHistoryPreloadManager.swift b/TelegramCore/ChatHistoryPreloadManager.swift index 6f4a2920a7..f3095a4ddd 100644 --- a/TelegramCore/ChatHistoryPreloadManager.swift +++ b/TelegramCore/ChatHistoryPreloadManager.swift @@ -276,8 +276,6 @@ final class ChatHistoryPreloadManager { switch index.entity { case let .peer(peerId): key = .messageOfInterestHole(location: .peer(peerId), namespace: Namespaces.Message.Cloud, count: 60) - /*case let .group(groupId): - key = .messageOfInterestHole(location: .group(groupId), namespace: Namespaces.Message.Cloud, count: 60)*/ } view.disposable.set((self.postbox.combinedView(keys: [key]) |> deliverOn(self.queue)).start(next: { [weak self] next in diff --git a/TelegramCore/CloudFileMediaResource.swift b/TelegramCore/CloudFileMediaResource.swift index 7f0cf5770f..612b332703 100644 --- a/TelegramCore/CloudFileMediaResource.swift +++ b/TelegramCore/CloudFileMediaResource.swift @@ -464,11 +464,7 @@ public class CloudDocumentMediaResource: TelegramCloudMediaResource, TelegramMul } func apiInputLocation(fileReference: Data?) -> Api.InputFileLocation? { - if let fileReference = fileReference { - return Api.InputFileLocation.inputDocumentFileLocation(id: self.fileId, accessHash: self.accessHash, fileReference: Buffer(data: fileReference), thumbSize: "") - } else { - return nil - } + return Api.InputFileLocation.inputDocumentFileLocation(id: self.fileId, accessHash: self.accessHash, fileReference: Buffer(data: fileReference ?? Data()), thumbSize: "") } public init(datacenterId: Int, fileId: Int64, accessHash: Int64, size: Int?, fileReference: Data?, fileName: String?) {