Rewrote “Hide Collapse Button” Option

Additional changes:
Added thanks button support??? (Cannot confirm if it works or not. This was implemented without the knowledge of how the button works.)
This commit is contained in:
arichornlover 2024-03-05 20:26:01 -06:00 committed by GitHub
parent a2ee8e86c8
commit 80043729db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -613,9 +613,17 @@ static NSString *accessGroupID() {
} }
} }
- (BOOL)watchCollapseButtonHidden { - (BOOL)watchCollapseButtonHidden {
return YES; if (IS_ENABLED(@"disableCollapseButton_enabled")) {
return YES;
} else {
return %orig;
}
} }
- (void)setWatchCollapseButtonAvailable:(BOOL)available { - (void)setWatchCollapseButtonAvailable:(BOOL)available {
if (IS_ENABLED(@"disableCollapseButton_enabled")) {
} else {
%orig(available);
}
} }
%end %end
@ -910,14 +918,14 @@ static NSString *accessGroupID() {
} }
%end %end
// Hide the (Connect / Thanks / Save) Buttons under the Video Player - 17.x.x and up - @PoomSmart (inspired by @arichornlover) // Hide the (Connect / Save) Buttons under the Video Player - 17.x.x and up - @PoomSmart (inspired by @arichornlover)
%hook _ASDisplayView %hook _ASDisplayView
- (void)layoutSubviews { - (void)layoutSubviews {
%orig; %orig;
BOOL hideConnectButton = IS_ENABLED(@"hideConnectButton_enabled"); BOOL hideConnectButton = IS_ENABLED(@"hideConnectButton_enabled");
// BOOL hideShareButton = IS_ENABLED(@"hideShareButton_enabled"); // OLD // BOOL hideShareButton = IS_ENABLED(@"hideShareButton_enabled"); // OLD
// BOOL hideRemixButton = IS_ENABLED(@"hideRemixButton_enabled"); // OLD // BOOL hideRemixButton = IS_ENABLED(@"hideRemixButton_enabled"); // OLD
BOOL hideThanksButton = IS_ENABLED(@"hideThanksButton_enabled"); // BOOL hideThanksButton = IS_ENABLED(@"hideThanksButton_enabled"); // OLD
// BOOL hideAddToOfflineButton = IS_ENABLED(@"hideAddToOfflineButton_enabled"); // OLD // BOOL hideAddToOfflineButton = IS_ENABLED(@"hideAddToOfflineButton_enabled"); // OLD
// BOOL hideClipButton = IS_ENABLED(@"hideClipButton_enabled"); // OLD // BOOL hideClipButton = IS_ENABLED(@"hideClipButton_enabled"); // OLD
BOOL hideSaveToPlaylistButton = IS_ENABLED(@"hideSaveToPlaylistButton_enabled"); BOOL hideSaveToPlaylistButton = IS_ENABLED(@"hideSaveToPlaylistButton_enabled");
@ -926,9 +934,6 @@ static NSString *accessGroupID() {
if ([subview.accessibilityLabel isEqualToString:@"connect account"]) { if ([subview.accessibilityLabel isEqualToString:@"connect account"]) {
subview.hidden = hideConnectButton; subview.hidden = hideConnectButton;
// subview.frame = hideConnectButton ? CGRectZero : subview.frame; // subview.frame = hideConnectButton ? CGRectZero : subview.frame;
} else if ([subview.accessibilityLabel isEqualToString:@"Thanks"]) {
subview.hidden = hideThanksButton;
// subview.frame = hideThanksButton ? CGRectZero : subview.frame;
} else if ([subview.accessibilityLabel isEqualToString:@"Save to playlist"]) { } else if ([subview.accessibilityLabel isEqualToString:@"Save to playlist"]) {
subview.hidden = hideSaveToPlaylistButton; subview.hidden = hideSaveToPlaylistButton;
// subview.frame = hideSaveToPlaylistButton ? CGRectZero : subview.frame; // subview.frame = hideSaveToPlaylistButton ? CGRectZero : subview.frame;
@ -979,6 +984,10 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
return CGSizeZero; return CGSizeZero;
} }
if (IS_ENABLED(@"hideThanksButton_enabled") && findCell(nodeController, @[@"thanks_button.eml"])) {
return CGSizeZero;
}
if (IS_ENABLED(@"hideClipButton_enabled") && findCell(nodeController, @[@"clip_button.eml"])) { if (IS_ENABLED(@"hideClipButton_enabled") && findCell(nodeController, @[@"clip_button.eml"])) {
return CGSizeZero; return CGSizeZero;
} }