Skip to content

Commit

Permalink
Added count property that reflect actual asset count
Browse files Browse the repository at this point in the history
Change-Id: I7a377ff53592200ba916b22319c6ca5c35cddea7
  • Loading branch information
kwigbo authored and tilltue committed Jul 6, 2024
1 parent b5b69f4 commit e1e1e51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions TLPhotoPicker/Classes/TLAssetsCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,11 @@ public struct TLAssetsCollection {
return count + (self.useCameraButton ? 1 : 0)
}
}
var assetCount: Int {
get {
return self.fetchResult?.count ?? 0
}
}

init(collection: PHAssetCollection) {
self.phAssetCollection = collection
Expand Down
2 changes: 1 addition & 1 deletion TLPhotoPicker/Classes/TLPhotosPickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ extension TLPhotosPickerViewController: TLPhotoLibraryDelegate {
func loadCompleteAllCollection(collections: [TLAssetsCollection]) {
self.collections = collections
self.focusFirstCollection()
let isEmpty = !self.collections.contains(where: { $0.count > 0 })
let isEmpty = !self.collections.contains(where: { $0.assetCount > 0 })
self.subTitleStackView.isHidden = isEmpty
self.emptyView.isHidden = !isEmpty
self.emptyImageView.isHidden = self.emptyImageView.image == nil
Expand Down

0 comments on commit e1e1e51

Please sign in to comment.