mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-03-11 21:26:04 +00:00
Added Hide Remix Button + Other Changes
Some of the changes were hard to do. Including the Hide Remix and Download buttons. And some of the other changes are Inspired and based off of YouTube Revanced (& Revanced Extended)
This commit is contained in:
parent
4641328c9b
commit
a40becdb44
1 changed files with 51 additions and 12 deletions
63
uYouPlus.xm
63
uYouPlus.xm
|
|
@ -788,11 +788,6 @@ static void replaceTab(YTIGuideResponse *response) {
|
|||
if (IsEnabled(@"hideCommunityPosts_enabled") && ([idToRemove rangeOfString:@"id.ui.backstage.post"].location != NSNotFound || [idToRemove rangeOfString:@"id.ui.backstage.original_post"].location != NSNotFound)) {
|
||||
[self removeCellsAtIndexPath:indexPath];
|
||||
}
|
||||
|
||||
// Hide Shorts Cells (from YTLite) - @dayanch96
|
||||
if (IsEnabled(@"hideShortsCells_enabled") && ([idToRemove isEqualToString:@"eml.shorts-grid"] || [idToRemove isEqualToString:@"eml.inline_shorts"] || [idToRemove isEqualToString:@"eml.shorts-video-item"])) {
|
||||
[self removeCellsAtIndexPath:indexPath];
|
||||
}
|
||||
}
|
||||
}
|
||||
return cell;
|
||||
|
|
@ -803,19 +798,63 @@ static void replaceTab(YTIGuideResponse *response) {
|
|||
}
|
||||
%end
|
||||
|
||||
// Hide the Download Button under the Video Player - @arichorn
|
||||
// Hide Shorts Cells - @arichorn
|
||||
%hook _ASDisplayView
|
||||
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
UICollectionViewCell *cell = %orig;
|
||||
|
||||
NSString *idToRemove = cell.reuseIdentifier;
|
||||
if (IsEnabled(@"hideShortsCells_enabled") && ([idToRemove isEqualToString:@"eml.shorts-grid"]
|
||||
|| [idToRemove isEqualToString:@"eml.inline_shorts"]
|
||||
|| [idToRemove isEqualToString:@"eml.shorts-video-item"]
|
||||
|| [idToRemove isEqualToString:@"eml.shelf_header"])) {
|
||||
UIResponder *nextResponder = self.nextResponder;
|
||||
while (nextResponder && ![nextResponder isKindOfClass:NSClassFromString(@"UICollectionViewController")]) {
|
||||
nextResponder = nextResponder.nextResponder;
|
||||
}
|
||||
if ([nextResponder respondsToSelector:@selector(removeCellsAtIndexPath:)]) {
|
||||
[nextResponder performSelector:@selector(removeCellsAtIndexPath:) withObject:indexPath];
|
||||
}
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
%end
|
||||
|
||||
// Hide the (Download Button / Remix Button) under the Video Player - @arichorn
|
||||
%hook _ASDisplayView
|
||||
- (id)initWithElement:(ELMElement *)element {
|
||||
id result = %orig;
|
||||
if (IsEnabled(@"hideAddToOfflineButton_enabled")) {
|
||||
NSString *(*identifierSelector)(id, SEL) = (NSString *(*)(id, SEL))[element methodForSelector:NSSelectorFromString(@"identifier")];
|
||||
NSString *identifier = identifierSelector(element, NSSelectorFromString(@"identifier"));
|
||||
if ([identifier isEqualToString:@"id.ui.add_to.offline.button"]) {
|
||||
[result setHidden:YES];
|
||||
_ASDisplayView *result = (_ASDisplayView *)%orig;
|
||||
|
||||
BOOL hideAddToOfflineButtonEnabled = IsEnabled(@"hideAddToOfflineButton_enabled");
|
||||
BOOL hideRemixButtonEnabled = IsEnabled(@"hideRemixButton_enabled");
|
||||
NSString *identifier = [element valueForKey:@"identifier"];
|
||||
|
||||
[self findCellContainingButton:(UIButton *)result];
|
||||
|
||||
if ((hideAddToOfflineButtonEnabled && [identifier isEqualToString:@"id.ui.add_to.offline.button"]) ||
|
||||
(hideRemixButtonEnabled && [identifier isEqualToString:@"id.video.remix.button"])) {
|
||||
|
||||
_ASDisplayView *cell = (_ASDisplayView *)[self findCellContainingButton:(UIButton *)result];
|
||||
if (cell != nil && [identifier containsString:@"ELMContainerNode-View"]) {
|
||||
NSRange range = [identifier rangeOfString:@"id.ui.add_to.offline.button"];
|
||||
if (range.location != NSNotFound) {
|
||||
// NSString *subIdentifier = [identifier substringWithRange:range];
|
||||
// If you intend to use subIdentifier later, you can uncomment the above line. (uYouPlusExtra)
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
- (id)findCellContainingButton:(UIButton *)button {
|
||||
UIView *superView = button.superview;
|
||||
while (superView != nil) {
|
||||
if ([superView isKindOfClass:[UIView class]]) {
|
||||
return superView;
|
||||
}
|
||||
superView = superView.superview;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
%end
|
||||
|
||||
// App Settings Overlay Options
|
||||
|
|
|
|||
Loading…
Reference in a new issue