From d9e7a4f649e6735ba0e096f3093b79a16c9c58d2 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Sun, 15 Sep 2024 21:45:37 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20resource=20type=20predicat?= =?UTF-8?q?e=20for=20original=20videos=20on=20iOS=20Fixes=20https://github?= =?UTF-8?q?.com/fluttercandies/flutter=5Fphoto=5Fmanager/issues/1180?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Classes/core/PHAssetResource+PM_COMMON.m | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ios/Classes/core/PHAssetResource+PM_COMMON.m b/ios/Classes/core/PHAssetResource+PM_COMMON.m index 98db6436..adddf792 100644 --- a/ios/Classes/core/PHAssetResource+PM_COMMON.m +++ b/ios/Classes/core/PHAssetResource+PM_COMMON.m @@ -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); } @@ -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; }