mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Rename TelegramCore source folder
This commit is contained in:
20
submodules/TelegramCore/Sources/DecryptedResourceData.swift
Normal file
20
submodules/TelegramCore/Sources/DecryptedResourceData.swift
Normal file
@@ -0,0 +1,20 @@
|
||||
import Foundation
|
||||
#if os(macOS)
|
||||
import PostboxMac
|
||||
#else
|
||||
import Postbox
|
||||
#endif
|
||||
|
||||
public func decryptedResourceData(data: MediaResourceData, resource: MediaResource, params: Any) -> Data? {
|
||||
guard data.complete else {
|
||||
return nil
|
||||
}
|
||||
guard let data = try? Data(contentsOf: URL(fileURLWithPath: data.path), options: [.mappedRead]) else {
|
||||
return nil
|
||||
}
|
||||
if let resource = resource as? EncryptedMediaResource {
|
||||
return resource.decrypt(data: data, params: params)
|
||||
} else {
|
||||
return data
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user