From cc8f4ce4ed909dd89d7d4755d910fc570f75428d Mon Sep 17 00:00:00 2001 From: Aric <78001398+arichorn@users.noreply.github.com> Date: Tue, 20 Sep 2022 20:01:34 -0500 Subject: [PATCH] uYouPlusExtra New Branch As usual, I always gotta refresh the main branch to always update uYouPlusExtra Properly. --- Settings.xm | 80 +++++++++++++++++++++-- uYouPlus.xm | 179 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 250 insertions(+), 9 deletions(-) diff --git a/Settings.xm b/Settings.xm index 7cd2bd8..dffe729 100644 --- a/Settings.xm +++ b/Settings.xm @@ -25,6 +25,13 @@ extern BOOL hidePreviousAndNextButton(); extern BOOL hidePaidPromotionCard(); extern BOOL fixGoogleSignIn(); extern BOOL replacePreviousAndNextButton(); +extern BOOL ytDisableHighContrastUI(); +extern BOOL BlueUI(); +extern BOOL RedUI(); +extern BOOL OrangeUI(); +extern BOOL PinkUI(); +extern BOOL PurpleUI(); +extern BOOL GreenUI(); // Settings %hook YTAppSettingsPresentationData @@ -53,6 +60,69 @@ extern BOOL replacePreviousAndNextButton(); exit(0); }]; + YTSettingsSectionItem *GreenUI = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Green UI" titleDescription:@"Green UI (have every other ui colors off) App restart is required."]; + GreenUI.hasSwitch = YES; + GreenUI.switchVisible = YES; + GreenUI.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"GreenUI_enabled"]; + GreenUI.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) { + [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"GreenUI_enabled"]; + return YES; + }; + + YTSettingsSectionItem *PurpleUI = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Purple UI" titleDescription:@"Purple UI (have every other ui colors off) App restart is required."]; + PurpleUI.hasSwitch = YES; + PurpleUI.switchVisible = YES; + PurpleUI.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"PurpleUI_enabled"]; + PurpleUI.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) { + [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"PurpleUI_enabled"]; + return YES; + }; + + YTSettingsSectionItem *PinkUI = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Pink UI" titleDescription:@"Pink UI (have every other ui colors off) App restart is required."]; + PinkUI.hasSwitch = YES; + PinkUI.switchVisible = YES; + PinkUI.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"PinkUI_enabled"]; + PinkUI.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) { + [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"PinkUI_enabled"]; + return YES; + }; + + YTSettingsSectionItem *OrangeUI = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Orange UI" titleDescription:@"Orange UI (have every other ui colors off) App restart is required."]; + OrangeUI.hasSwitch = YES; + OrangeUI.switchVisible = YES; + OrangeUI.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"OrangeUI_enabled"]; + OrangeUI.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) { + [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"OrangeUI_enabled"]; + return YES; + }; + + YTSettingsSectionItem *RedUI = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Red UI" titleDescription:@"Red UI (have every other ui colors off) App restart is required."]; + RedUI.hasSwitch = YES; + RedUI.switchVisible = YES; + RedUI.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"RedUI_enabled"]; + RedUI.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) { + [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"RedUI_enabled"]; + return YES; + }; + + YTSettingsSectionItem *BlueUI = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"Blue UI") titleDescription:LOC(@"Blue UI (have every other ui colors off) App restart is required.")]; + BlueUI.hasSwitch = YES; + BlueUI.switchVisible = YES; + BlueUI.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"BlueUI_enabled"]; + BlueUI.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) { + [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"BlueUI_enabled"]; + return YES; + }; + + YTSettingsSectionItem *ytDisableHighContrastUI = [[%c(YTSettingsSectionItem) alloc] initWithTitle:@"Revert The High Contrast UI (YTDisableHighContrastUI)" titleDescription:@"App restart is required."]; + ytDisableHighContrastUI.hasSwitch = YES; + ytDisableHighContrastUI.switchVisible = YES; + ytDisableHighContrastUI.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"ytDisableHighContrastUI_enabled"]; + ytDisableHighContrastUI.switchBlock = ^BOOL (YTSettingsCell *cell, BOOL enabled) { + [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"ytDisableHighContrastUI_enabled"]; + return YES; + }; + YTSettingsSectionItem *replacePreviousAndNextButton = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"REPLACE_PREVIOUS_NEXT_BUTTON") titleDescription:LOC(@"REPLACE_PREVIOUS_NEXT_BUTTON_DESC")]; replacePreviousAndNextButton.hasSwitch = YES; replacePreviousAndNextButton.switchVisible = YES; @@ -61,8 +131,8 @@ extern BOOL replacePreviousAndNextButton(); [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"replacePreviousAndNextButton_enabled"]; return YES; }; - - YTSettingsSectionItem *fixGoogleSignIn = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"FIX_GOOGLE_SIGNIN") titleDescription:LOC(@"FIX_GOOGLE_SIGNIN_DESC")]; + + YTSettingsSectionItem *fixGoogleSigin = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"FIX_GOOGLE_SIGNIN") titleDescription:LOC(@"FIX_GOOGLE_SIGNIN_DESC")]; fixGoogleSignIn.hasSwitch = YES; fixGoogleSignIn.switchVisible = YES; fixGoogleSignIn.on = [[NSUserDefaults standardUserDefaults] boolForKey:@"fixGoogleSignIn_enabled"]; @@ -70,7 +140,7 @@ extern BOOL replacePreviousAndNextButton(); [[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"fixGoogleSignIn_enabled"]; return YES; }; - + YTSettingsSectionItem *hidePaidPromotionCard = [[%c(YTSettingsSectionItem) alloc] initWithTitle:LOC(@"HIDE_PAID_PROMOTION_CARDS") titleDescription:LOC(@"HIDE_PAID_PROMOTION_CARDS_DESC")]; hidePaidPromotionCard.hasSwitch = YES; hidePaidPromotionCard.switchVisible = YES; @@ -188,7 +258,7 @@ extern BOOL replacePreviousAndNextButton(); return YES; }; - NSMutableArray *sectionItems = [NSMutableArray arrayWithArray:@[killApp, autoFull, castConfirm, ytMiniPlayer, fixGoogleSignIn, hideAutoplaySwitch, hideCC, hideHUD, hidePaidPromotionCard, hidePreviousAndNextButton, hideHoverCard, bigYTMiniPlayer, oledDarkMode, oledKeyBoard, replacePreviousAndNextButton, reExplore]]; + NSMutableArray *sectionItems = [NSMutableArray arrayWithArray:@[killApp, autoFull, castConfirm, ytMiniPlayer, fixGoogleSignIn, hideAutoplaySwitch, hideCC, hideHUD, hidePaidPromotionCard, hidePreviousAndNextButton, hideHoverCard, bigYTMiniPlayer, oledDarkMode, oledKeyBoard, replacePreviousAndNextButton, reExplore, ytDisableHighContrastUI, BlueUI, RedUI, OrangeUI, PinkUI, PurpleUI, GreenUI]]; [delegate setSectionItems:sectionItems forCategory:uYouPlusSection title:@"uYouPlus" titleDescription:nil headerHidden:NO]; } @@ -199,4 +269,4 @@ extern BOOL replacePreviousAndNextButton(); } %orig; } -%end \ No newline at end of file +%end diff --git a/uYouPlus.xm b/uYouPlus.xm index fe78e58..c80c398 100644 --- a/uYouPlus.xm +++ b/uYouPlus.xm @@ -33,8 +33,8 @@ NSBundle *tweakBundle = uYouPlusBundle(); // Keychain patching static NSString *accessGroupID() { NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys: - (__bridge NSString *)kSecClassGenericPassword, (__bridge NSString *)kSecClass, - @"bundleSeedID", kSecAttrAccount, + (__bridge NSString *)kSecClassGenericPassword, (__bridge NSString *)kSecClass, + @"bundleSeedID", kSecAttrAccount, @"", kSecAttrService, (id)kCFBooleanTrue, kSecReturnAttributes, nil]; @@ -49,7 +49,7 @@ static NSString *accessGroupID() { return accessGroup; } -// +// BOOL hideHUD() { return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideHUD_enabled"]; } @@ -98,6 +98,27 @@ BOOL fixGoogleSignIn() { BOOL replacePreviousAndNextButton() { return [[NSUserDefaults standardUserDefaults] boolForKey:@"replacePreviousAndNextButton_enabled"]; } +BOOL ytDisableHighContrastUI () { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"ytDisableHighContrastUI_enabled"]; +} +BOOL BlueUI () { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"BlueUI_enabled"]; +} +BOOL RedUI () { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"RedUI_enabled"]; +} +BOOL OrangeUI () { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"OrangeUI_enabled"]; +} +BOOL PinkUI () { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"PinkUI_enabled"]; +} +BOOL PurpleUI () { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"PurpleUI_enabled"]; +} +BOOL GreenUI () { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"GreenUI_enabled"]; +} # pragma mark - Tweaks // Enable Reorder videos from playlist while on the Watch page - @PoomSmart @@ -154,6 +175,11 @@ BOOL replacePreviousAndNextButton() { } %end +// Hide Update Dialog: https://github.com/PoomSmart/YouTubeHeader/blob/main/YTGlobalConfig.h +%hook YTGlobalConfig +- (BOOL)shouldBlockUpgradeDialog { return YES;} +%end + // YTAutoFullScreen: https://github.com/PoomSmart/YTAutoFullScreen/ %hook YTPlayerViewController - (void)loadWithPlayerTransition:(id)arg1 playbackConfig:(id)arg2 { @@ -301,6 +327,11 @@ BOOL replacePreviousAndNextButton() { - (void)setUserInteractionEnabled:(BOOL)enabled { %orig(YES); } %end +// Hide YouTube Heatwave in Video Player (YouTube 17.19.2 or newer) - @level3tjg - https://www.reddit.com/r/jailbreak/comments/v29yvk/ +%hook YTInlinePlayerBarContainerView +- (BOOL)canShowHeatwave { return NO;} +%end + // Workaround for issue #54 %hook YTMainAppVideoPlayerOverlayViewController - (void)updateRelatedVideos { @@ -510,7 +541,7 @@ BOOL replacePreviousAndNextButton() { // Fix "You can't sign in to this app because Google can't confirm that it's safe" warning when signing in. by julioverne & PoomSmart // https://gist.github.com/PoomSmart/ef5b172fd4c5371764e027bea2613f93 // https://github.com/qnblackcat/uYouPlus/pull/398 -/* +/* %group gDevice_challenge_request_hack %hook SSOService + (id)fetcherWithRequest:(NSMutableURLRequest *)request configuration:(id)configuration { @@ -876,6 +907,125 @@ static void replaceTab(YTIGuideResponse *response) { %end %end +%group gYTDisableHighContrastUI +%hook YTCommonColorPalette +- (UIColor *)textPrimary { + if (self.pageStyle == 1) { + return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00]; + } + return [UIColor colorWithRed: 0.38 green: 0.38 blue: 0.38 alpha: 1.00]; + } +- (UIColor *)textSecondary { + if (self.pageStyle == 1) { + return [UIColor colorWithRed: 0.56 green: 0.56 blue: 0.56 alpha: 1.00]; + } + return [UIColor colorWithRed: 0.38 green: 0.38 blue: 0.38 alpha: 1.00]; + } +%end +%end + +%group gBlueUI +%hook YTCommonColorPalette +- (UIColor *)textPrimary { + if (self.pageStyle == 1) { + return [UIColor colorWithRed: 0.26 green: 0.43 blue: 0.48 alpha: 1.00]; + } + return [UIColor colorWithRed: 0.36 green: 0.56 blue: 0.62 alpha: 1.00]; + } +- (UIColor *)textSecondary { + if (self.pageStyle == 1) { + return [UIColor colorWithRed: 0.26 green: 0.43 blue: 0.48 alpha: 1.00]; + } + return [UIColor colorWithRed: 0.36 green: 0.56 blue: 0.62 alpha: 1.00]; + } +%end +%end + +%group gRedUI +%hook YTCommonColorPalette +- (UIColor *)textPrimary { + if (self.pageStyle == 1) { + return [UIColor colorWithRed: 1.00 green: 0.31 blue: 0.27 alpha: 1.00]; + } + return [UIColor colorWithRed: 0.84 green: 0.25 blue: 0.23 alpha: 1.00]; + } +- (UIColor *)textSecondary { + if (self.pageStyle == 1) { + return [UIColor colorWithRed: 1.00 green: 0.31 blue: 0.27 alpha: 1.00]; + } + return [UIColor colorWithRed: 0.84 green: 0.25 blue: 0.23 alpha: 1.00]; + } +%end +%end + +%group gOrangeUI +%hook YTCommonColorPalette +- (UIColor *)textPrimary { + if (self.pageStyle == 1) { + return [UIColor colorWithRed: 0.73 green: 0.45 blue: 0.05 alpha: 1.00]; + } + return [UIColor colorWithRed: 0.80 green: 0.49 blue: 0.05 alpha: 1.00]; + } +- (UIColor *)textSecondary { + if (self.pageStyle == 1) { + return [UIColor colorWithRed: 0.73 green: 0.45 blue: 0.05 alpha: 1.00]; + } + return [UIColor colorWithRed: 0.80 green: 0.49 blue: 0.05 alpha: 1.00]; + } +%end +%end + +%group gPinkUI +%hook YTCommonColorPalette +- (UIColor *)textPrimary { + if (self.pageStyle == 1) { + return [UIColor colorWithRed: 0.74 green: 0.02 blue: 0.46 alpha: 1.00]; + } + return [UIColor colorWithRed: 0.81 green: 0.56 blue: 0.71 alpha: 1.00]; + } +- (UIColor *)textSecondary { + if (self.pageStyle == 1) { + return [UIColor colorWithRed: 0.74 green: 0.02 blue: 0.46 alpha: 1.00]; + } + return [UIColor colorWithRed: 0.81 green: 0.56 blue: 0.71 alpha: 1.00]; + } +%end +%end + +%group gPurpleUI +%hook YTCommonColorPalette +- (UIColor *)textPrimary { + if (self.pageStyle == 1) { + return [UIColor colorWithRed: 0.62 green: 0.01 blue: 0.73 alpha: 1.00]; + } + return [UIColor colorWithRed: 0.44 green: 0.00 blue: 0.52 alpha: 1.00]; + } +- (UIColor *)textSecondary { + if (self.pageStyle == 1) { + return [UIColor colorWithRed: 0.62 green: 0.01 blue: 0.73 alpha: 1.00]; + } + return [UIColor colorWithRed: 0.44 green: 0.00 blue: 0.52 alpha: 1.00]; + } +%end +%end + +%group gGreenUI +%hook YTCommonColorPalette +- (UIColor *)textPrimary { + if (self.pageStyle == 1) { + return [UIColor colorWithRed: 0.01 green: 0.66 blue: 0.18 alpha: 1.00]; + } + return [UIColor colorWithRed: 0.00 green: 0.50 blue: 0.13 alpha: 1.00]; + } +- (UIColor *)textSecondary { + if (self.pageStyle == 1) { + return [UIColor colorWithRed: 0.01 green: 0.66 blue: 0.18 alpha: 1.00]; + } + return [UIColor colorWithRed: 0.00 green: 0.50 blue: 0.13 alpha: 1.00]; + } +%end +%end + // iOS 16 uYou crash fix - @level3tjg: https://github.com/qnblackcat/uYouPlus/pull/224 %group iOS16 %hook OBPrivacyLinkButton @@ -925,4 +1075,25 @@ static void replaceTab(YTIGuideResponse *response) { if (!fixGoogleSignIn()) { %init(gFixGoogleSignIn); } + if (ytDisableHighContrastUI()) { + %init(gYTDisableHighContrastUI); + } + if (BlueUI()) { + %init(gBlueUI); + } + if (RedUI()) { + %init(gRedUI); + } + if (OrangeUI()) { + %init(gOrangeUI); + } + if (PinkUI()) { + %init(gPinkUI); + } + if (PurpleUI()) { + %init(gPurpleUI); + } + if (GreenUI()) { + %init(gGreenUI); + } }