Hide Get Youtube Premium

This commit is contained in:
Bryce Hackel 2024-04-02 20:28:00 -07:00
parent 4095dabcb1
commit 3738ed19bb
No known key found for this signature in database
GPG key ID: F031960F08455E88
3 changed files with 31 additions and 0 deletions

View file

@ -27,6 +27,7 @@
#import "Tweaks/YouTubeHeader/YTInlinePlayerBarContainerView.h"
#import "Tweaks/YouTubeHeader/YTInnerTubeCollectionViewController.h"
#import "Tweaks/YouTubeHeader/YTPivotBarItemView.h"
#import "Tweaks/YouTubeHeader/YTCollectionViewCell.h"
// Hide buttons under the video player by @PoomSmart
#import "Tweaks/YouTubeHeader/ASCollectionElement.h"
@ -64,6 +65,13 @@
@property(readonly, nonatomic) YTIIcon *iconImage;
@end
// Hide Premium Promo in You tab - @bhackel
@interface YTFormattedStringLabel : UILabel
@end
@interface YTLinkCell : YTCollectionViewCell
@property(readonly, nonatomic) YTFormattedStringLabel *titleLabel;
@end
// uYouPlus
@interface YTHeaderLogoController : UIView
@property(readonly, nonatomic) long long pageStyle;

View file

@ -274,6 +274,25 @@ BOOL isAd(YTIElementRenderer *self) {
- (BOOL)savedSettingShouldExpire { return NO; }
%end
// Hide Premium promos in "You" and "Library" tab - @bhackel
%group gHidePremiumPromos
// Hide "Get Youtube Premium" in the "You" tab
%hook YTLinkCell
- (void)layoutSubviews {
%orig;
// Get the text label object for this cell
YTFormattedStringLabel *label = self.titleLabel;
// Check if the cell is a premium promo
if ([label.accessibilityLabel isEqualToString:@"Get YouTube Premium"]) {
// Hide the cell
self.hidden = YES;
self.frame = CGRectZero;
}
}
%end
%end
// YTShortsProgress - https://github.com/PoomSmart/YTShortsProgress/
%hook YTShortsPlayerViewController
- (BOOL)shouldAlwaysEnablePlayerBar { return YES; }
@ -1322,6 +1341,9 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
if (IS_ENABLED(@"YTTapToSeek_enabled")) {
%init(YTTTS_Tweak);
}
if (IS_ENABLED(@"hidePremiumPromos_enabled")) {
%init(gHidePremiumPromos);
}
// YTNoModernUI - @arichorn
BOOL ytNoModernUIEnabled = IS_ENABLED(@"ytNoModernUI_enabled");

View file

@ -275,6 +275,7 @@ extern NSBundle *uYouPlusBundle();
SWITCH_ITEM2(LOC(@"Hide `Your data in YouTube` Section"), LOC(@"App restart is required."), @"disableYourDataInYouTubeSection_enabled");
SWITCH_ITEM2(LOC(@"Hide `Privacy` Section"), LOC(@"App restart is required."), @"disablePrivacySection_enabled");
SWITCH_ITEM2(LOC(@"Hide `Live Chat` Section"), LOC(@"App restart is required."), @"disableLiveChatSection_enabled");
SWITCH_ITEM2(LOC(@"Hide Premium Promos"), LOC(@"App restart is required."), @"hidePremiumPromos_enabled");
# pragma mark - UI interface options
SECTION_HEADER(LOC(@"UI Interface Options"));