Skip to content

Commit

Permalink
🐛 Fix resource type predicate for original videos on iOS
Browse files Browse the repository at this point in the history
Fixes #1180
  • Loading branch information
AlexV525 committed Sep 15, 2024
1 parent 9617dc1 commit d9e7a4f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions ios/Classes/core/PHAssetResource+PM_COMMON.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

@implementation PHAssetResource (PM_COMMON)

- (bool)isImage{
- (bool)isImage {
return [self type] == PHAssetResourceTypePhoto
|| [self type] == PHAssetResourceTypeAlternatePhoto
|| [self type] == PHAssetResourceTypeFullSizePhoto
|| [self type] == PHAssetResourceTypeAdjustmentBasePhoto;
}

- (bool)isVideo{
BOOL predicate = [self type] == PHAssetResourceTypeVideo;
- (bool)isVideo {
BOOL predicate = [self type] == PHAssetResourceTypeVideo || PHAssetResourceTypeFullSizeVideo;
if (@available(iOS 9.1, *)) {
predicate = (predicate || [self type] == PHAssetResourceTypePairedVideo);
}
Expand All @@ -29,23 +29,22 @@ - (bool)isVideo{
return predicate;
}

- (bool)isAudio{
- (bool)isAudio {
return [self type] == PHAssetResourceTypeAudio;
}

- (bool)isImageOrVideo{
- (bool)isImageOrVideo {
return [self isVideo] || [self isImage];
}

- (bool)isValid {
bool isResource = self.type != PHAssetResourceTypeAdjustmentData;

#if __IPHONE_17_0
if (@available(iOS 17.0, *)) {
isResource = isResource && self.type != PHAssetResourceTypePhotoProxy;
}
#endif

return isResource;
}

Expand Down

0 comments on commit d9e7a4f

Please sign in to comment.