add modificationDate as second sort key in iOS

This commit is contained in:
Wenqi Li 2021-04-04 18:17:11 +08:00
parent 184b728f12
commit e74d40b682

View File

@ -170,7 +170,10 @@ public class SwiftPhotoGalleryPlugin: NSObject, FlutterPlugin {
private func listMedia(albumId: String, skip: NSNumber?, take: NSNumber?, mediumType: String) -> NSDictionary { private func listMedia(albumId: String, skip: NSNumber?, take: NSNumber?, mediumType: String) -> NSDictionary {
let fetchOptions = PHFetchOptions() let fetchOptions = PHFetchOptions()
fetchOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)] fetchOptions.sortDescriptors = [
NSSortDescriptor(key: "creationDate", ascending: false),
NSSortDescriptor(key: "modificationDate", ascending: false)
]
fetchOptions.predicate = predicateFromMediumType(mediumType: mediumType) fetchOptions.predicate = predicateFromMediumType(mediumType: mediumType)
let collection = self.assetCollections.first(where: { (collection) -> Bool in let collection = self.assetCollections.first(where: { (collection) -> Bool in