mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Refactoring
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
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