Add support for "hidden" smart asset group

This commit is contained in:
Ilya Laktyushin
2019-10-06 19:40:28 +03:00
parent e459fafdf1
commit b79367fbd0
4 changed files with 17 additions and 7 deletions

View File

@@ -17,7 +17,8 @@ typedef enum
TGMediaAssetGroupSubtypeBursts,
TGMediaAssetGroupSubtypeScreenshots,
TGMediaAssetGroupSubtypeAnimated,
TGMediaAssetGroupSubtypeRegular
TGMediaAssetGroupSubtypeRegular,
TGMediaAssetGroupSubtypeHidden
} TGMediaAssetGroupSubtype;
@interface TGMediaAssetGroup : NSObject

View File

@@ -245,6 +245,10 @@
case PHAssetCollectionSubtypeSmartAlbumAnimated:
return TGMediaAssetGroupSubtypeAnimated;
case PHAssetCollectionSubtypeSmartAlbumAllHidden:
return TGMediaAssetGroupSubtypeHidden;
default:
return TGMediaAssetGroupSubtypeRegular;
}
@@ -360,6 +364,12 @@
}
}
case PHAssetCollectionSubtypeSmartAlbumAllHidden:
{
return true;
}
break;
default:
{
return false;

View File

@@ -61,10 +61,6 @@
PHFetchOptions *options = [[PHFetchOptions alloc] init];
options.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"startDate" ascending:true]];
//PHFetchResult *moments = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeMoment subtype:PHAssetCollectionSubtypeAny options:options];
//TGMediaAssetMomentList *momentList = [[TGMediaAssetMomentList alloc] initWithPHFetchResult:moments];
//[groups insertObject:momentList atIndex:0];
return groups;
}];
};

View File

@@ -276,8 +276,7 @@ const CGFloat TGMediaGroupCellHeight = 86.0f;
_countLabel.text = [[NSString alloc] initWithFormat:@"%ld", (long)assetGroup.assetCount];
[self setNeedsLayout];
[self configureThumbnailsWithAssets:[assetGroup latestAssets]];
bool hideThumbnail = false;
UIImage *iconImage = nil;
switch (assetGroup.subtype)
{
@@ -313,10 +312,14 @@ const CGFloat TGMediaGroupCellHeight = 86.0f;
iconImage = TGComponentsImageNamed(@"MediaGroupSelfPortraits");
break;
case TGMediaAssetGroupSubtypeHidden:
hideThumbnail = true;
default:
break;
}
[self configureThumbnailsWithAssets:hideThumbnail ? @[] : [assetGroup latestAssets]];
_iconView.image = iconImage;
_iconView.hidden = (iconImage == nil);
_shadowView.hidden = _iconView.hidden;