simplify deleting medium method in iOS code
This commit is contained in:
parent
185628470a
commit
7635a8243f
@ -248,18 +248,11 @@ public class SwiftPhotoGalleryPlugin: NSObject, FlutterPlugin {
|
|||||||
completion(false, NSError(domain: "photo_gallery", code: 404, userInfo: nil))
|
completion(false, NSError(domain: "photo_gallery", code: 404, userInfo: nil))
|
||||||
} else {
|
} else {
|
||||||
let asset: PHAsset = assets[0]
|
let asset: PHAsset = assets[0]
|
||||||
deleteAssets(assets: [asset]) { success, error in
|
|
||||||
completion(success, error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private func deleteAssets(assets: [PHAsset], completion: @escaping (Bool, Error?) -> Void) {
|
|
||||||
PHPhotoLibrary.shared().performChanges({
|
PHPhotoLibrary.shared().performChanges({
|
||||||
PHAssetChangeRequest.deleteAssets(assets as NSFastEnumeration)
|
PHAssetChangeRequest.deleteAssets([asset] as NSFastEnumeration)
|
||||||
}, completionHandler: completion)
|
}, completionHandler: completion)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func getThumbnail(
|
private func getThumbnail(
|
||||||
mediumId: String,
|
mediumId: String,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user