another.im-ios/Monal/another.im/Helpers/PHImageManager+Fetch.swift

44 lines
1.5 KiB
Swift
Raw Normal View History

2024-11-20 13:31:51 +00:00
// import Photos
// import UIKit
//
// extension PHImageManager {
// func getPhoto(for asset: PHAsset) async throws -> UIImage {
// let options = PHImageRequestOptions()
// options.version = .original
// options.isSynchronous = true
// return try await withCheckedThrowingContinuation { continuation in
// requestImage(
// for: asset,
// targetSize: PHImageManagerMaximumSize,
// contentMode: .aspectFill,
// options: options
// ) { image, _ in
// if let image {
// continuation.resume(returning: image)
// } else {
// continuation.resume(throwing: AppError.imageNotFound)
// }
// }
// }
// }
//
// func getVideo(for asset: PHAsset) async throws -> AVAsset {
// let options = PHVideoRequestOptions()
// options.version = .original
// options.deliveryMode = .highQualityFormat
// options.isNetworkAccessAllowed = true
// return try await withCheckedThrowingContinuation { continuation in
// requestAVAsset(
// forVideo: asset,
// options: options
// ) { avAsset, _, _ in
// if let avAsset {
// continuation.resume(returning: avAsset)
// } else {
// continuation.resume(throwing: AppError.videoNotFound)
// }
// }
// }
// }
// }