Combine Premium Logo and fake You tab

This commit is contained in:
Bryce Hackel 2024-04-09 00:02:36 -04:00
parent 55cfde9391
commit 7fbdb6c5f7
No known key found for this signature in database
GPG key ID: F031960F08455E88
2 changed files with 24 additions and 64 deletions

View file

@ -133,59 +133,6 @@ BOOL isAd(YTIElementRenderer *self) {
%end
%end
// YouTube Premium Logo - @arichornlover - this doesn't always function
// Modern implementation - @bhackel
%group gPremiumYouTubeLogo
%hook YTHeaderLogoController
- (void)setTopbarLogoRenderer:(id)renderer {
// Modify the type of the icon before setting the renderer
YTITopbarLogoRenderer *logoRenderer = (YTITopbarLogoRenderer *)renderer;
YTIIcon *iconImage = logoRenderer.iconImage;
iconImage.iconType = 537; // magic number for Premium icon, hopefully it doesnt change. 158 is default logo.
// Use this modified renderer
%orig(logoRenderer);
}
// For when spoofing before 18.34.5
- (void)setPremiumLogo:(BOOL)isPremiumLogo {
isPremiumLogo = YES;
%orig;
}
- (BOOL)isPremiumLogo {
return YES;
}
%end
/*
%hook YTHeaderLogoController
- (void)setPremiumLogo:(BOOL)isPremiumLogo {
isPremiumLogo = YES;
%orig;
}
- (BOOL)isPremiumLogo {
return YES;
}
- (void)setTopbarLogoRenderer:(id)renderer {
}
%end
// Workaround: fix YouTube Premium Logo not working on v18.35.4 or above.
%hook YTVersionUtils // Working Version for Premium Logo
+ (NSString *)appVersion { return @"18.34.5"; }
%end
%hook YTSettingsCell // Remove v18.34.5 Version Number - @Dayanch96
- (void)setDetailText:(id)arg1 {
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *appVersion = infoDictionary[@"CFBundleShortVersionString"];
if ([arg1 isEqualToString:@"18.34.5"]) {
arg1 = appVersion;
} %orig(arg1);
}
%end
*/
%end
// Fix App Group Directory by move it to document directory
%hook NSFileManager
- (NSURL *)containerURLForSecurityApplicationGroupIdentifier:(NSString *)groupIdentifier {
@ -313,8 +260,28 @@ BOOL isAd(YTIElementRenderer *self) {
%end
%end
// Fake premium in the You tab - @bhackel
%group gYouTabFakePremium
// Fake premium - @bhackel
%group gFakePremium
// YouTube Premium Logo - @arichornlover - this doesn't always function
// Modern implementation - @bhackel
%hook YTHeaderLogoController
- (void)setTopbarLogoRenderer:(id)renderer {
// Modify the type of the icon before setting the renderer
YTITopbarLogoRenderer *logoRenderer = (YTITopbarLogoRenderer *)renderer;
YTIIcon *iconImage = logoRenderer.iconImage;
iconImage.iconType = 537; // magic number for Premium icon, hopefully it doesnt change. 158 is default logo.
// Use this modified renderer
%orig(logoRenderer);
}
// For when spoofing before 18.34.5
- (void)setPremiumLogo:(BOOL)isPremiumLogo {
isPremiumLogo = YES;
%orig;
}
- (BOOL)isPremiumLogo {
return YES;
}
%end
%hook YTAppCollectionViewController
/**
* Modify a given renderer data model to fake premium in the You tab
@ -1353,9 +1320,6 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
if (IS_ENABLED(@"centerYouTubeLogo_enabled")) {
%init(gCenterYouTubeLogo);
}
if (IS_ENABLED(@"premiumYouTubeLogo_enabled")) {
%init(gPremiumYouTubeLogo);
}
if (IS_ENABLED(@"hideSubscriptionsNotificationBadge_enabled")) {
%init(gHideSubscriptionsNotificationBadge);
}
@ -1450,7 +1414,7 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
%init(gHidePremiumPromos);
}
if (IS_ENABLED(@"youTabFakePremium_enabled")) {
%init(gYouTabFakePremium);
%init(gFakePremium);
}
// YTNoModernUI - @arichorn
@ -1458,14 +1422,11 @@ static BOOL findCell(ASNodeController *nodeController, NSArray <NSString *> *ide
if (ytNoModernUIEnabled) {
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setBool:NO forKey:@"enableVersionSpoofer_enabled"];
[userDefaults setBool:NO forKey:@"premiumYouTubeLogo_enabled"];
} else {
BOOL enableVersionSpooferEnabled = IS_ENABLED(@"enableVersionSpoofer_enabled");
BOOL premiumYouTubeLogoEnabled = IS_ENABLED(@"premiumYouTubeLogo_enabled");
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setBool:enableVersionSpooferEnabled forKey:@"enableVersionSpoofer_enabled"];
[userDefaults setBool:premiumYouTubeLogoEnabled forKey:@"premiumYouTubeLogo_enabled"];
}
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setBool:ytNoModernUIEnabled ? ytNoModernUIEnabled : [userDefaults boolForKey:@"fixLowContrastMode_enabled"] forKey:@"fixLowContrastMode_enabled"];

View file

@ -276,7 +276,6 @@ extern NSBundle *uYouPlusBundle();
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 `Get Youtube Premium` Section"), LOC(@"App restart is required."), @"hidePremiumPromos_enabled");
SWITCH_ITEM2(LOC(@"Fake Premium in You tab"), LOC(@"Makes it look like you have Premium. English only."), @"youTabFakePremium_enabled");
# pragma mark - UI interface options
SECTION_HEADER(LOC(@"UI Interface Options"));
@ -915,7 +914,7 @@ extern NSBundle *uYouPlusBundle();
# pragma mark - Miscellaneous
SECTION_HEADER(LOC(@"MISCELLANEOUS"));
SWITCH_ITEM(LOC(@"YouTube Premium Logo"), LOC(@"Toggle this to use the official YouTube Premium Logo. App restart is required."), @"premiumYouTubeLogo_enabled");
SWITCH_ITEM2(LOC(@"Fake Premium"), LOC(@"Uses Premium logo and creates fake buttons in the You tab"), @"youTabFakePremium_enabled");
// SWITCH_ITEM(LOC(@"Center YouTube Logo"), LOC(@"Toggle this to move the official YouTube Logo to the Center. App restart is required."), @"centerYouTubeLogo_enabled");
SWITCH_ITEM(LOC(@"Hide YouTube Logo"), LOC(@"Toggle this to hide the YouTube Logo in the YouTube App."), @"hideYouTubeLogo_enabled");
SWITCH_ITEM(LOC(@"ENABLE_YT_STARTUP_ANIMATION"), LOC(@"ENABLE_YT_STARTUP_ANIMATION_DESC"), @"ytStartupAnimation_enabled");