Updated Hide Shorts Cells

Hide Shorts Cells has an upgrade from PoomSmart & iCrazeiOS
This commit is contained in:
arichornlover 2023-11-23 20:30:09 -06:00 committed by GitHub
parent effb18e2c1
commit ae2793db39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1045,7 +1045,25 @@ static void replaceTab(YTIGuideResponse *response) {
}
%end
// Hide Shorts Cells - @MiRO92 & @arichorn
// Hide Shorts Cells - @PoomSmart & @iCrazeiOS
%hook YTIElementRenderer
- (NSData *)elementData {
NSString *description = [self description];
if (IsEnabled(@"hideShortsCells_enabled")) {
if ([description containsString:@"shorts_shelf.eml"] ||
[description containsString:@"#shorts"] ||
[description containsString:@"shorts_video_cell.eml"] ||
[description containsString:@"6Shorts"]) {
if (![description containsString:@"history*"]) {
return nil;
}
}
}
return %orig;
}
%end
// Hide Community Posts - @michael-winay & @arichorn
%hook YTAsyncCollectionView
- (id)cellForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewCell *cell = %orig;
@ -1054,18 +1072,6 @@ static void replaceTab(YTIGuideResponse *response) {
_ASCollectionViewCell *cell = %orig;
if ([cell respondsToSelector:@selector(node)]) {
NSString *idToRemove = [[cell node] accessibilityIdentifier];
if (IsEnabled(@"hideShortsCells_enabled")) {
if ([idToRemove isEqualToString:@"eml.shorts-video-item"] ||
[idToRemove isEqualToString:@"eml.shelf_header"] ||
[idToRemove isEqualToString:@"statement_banner.view"] ||
[idToRemove isEqualToString:@"compact.view"] ||
[idToRemove isEqualToString:@"eml.inline_shorts"]) {
[self removeShortsAndFeaturesAdsAtIndexPath:indexPath];
}
}
// Hide Community Posts
if (IsEnabled(@"hideCommunityPosts_enabled")) {
if ([idToRemove rangeOfString:@"id.ui.backstage.post"].location != NSNotFound) {
[self removeShortsAndFeaturesAdsAtIndexPath:indexPath];
@ -1079,7 +1085,6 @@ static void replaceTab(YTIGuideResponse *response) {
- (void)removeShortsAndFeaturesAdsAtIndexPath:(NSIndexPath *)indexPath {
[self deleteItemsAtIndexPaths:@[indexPath]];
}
%end
// Hide the (Remix / Thanks / Download / Clip / Save) Buttons under the Video Player - @arichorn