optimize iOS code
This commit is contained in:
parent
7635a8243f
commit
2d80702f09
@ -617,12 +617,15 @@ public class SwiftPhotoGalleryPlugin: NSObject, FlutterPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func extractSizeFromAsset(asset: PHAsset) -> Int64? {
|
private func extractSizeFromAsset(asset: PHAsset) -> Int64? {
|
||||||
let resources = PHAssetResource.assetResources(for: asset)
|
if #available(iOS 9.0, *) {
|
||||||
guard let resource = resources.first,
|
let resources = PHAssetResource.assetResources(for: asset)
|
||||||
let unsignedInt64 = resource.value(forKey: "fileSize") as? CLong else {
|
if let resource = resources.first{
|
||||||
return nil
|
if let unsignedInt64 = resource.value(forKey: "fileSize") as? CLong {
|
||||||
|
return Int64(unsignedInt64)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Int64(bitPattern: UInt64(unsignedInt64))
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
private func extractTitleFromFilename(filename: String?) -> String? {
|
private func extractTitleFromFilename(filename: String?) -> String? {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user