From a0fe2f8cc3761a164fe64e9112f0464da8dd2ff1 Mon Sep 17 00:00:00 2001 From: qnblackcat Date: Tue, 28 Feb 2023 16:57:31 +0700 Subject: [PATCH] fixed Google sign in (#683), fixed (#965), hide uYou Shorts buttons, enable startup animation --- uYouPlus.xm | 70 +++++++++++++++++++---------------------------------- 1 file changed, 25 insertions(+), 45 deletions(-) diff --git a/uYouPlus.xm b/uYouPlus.xm index f8f422f..d12135c 100644 --- a/uYouPlus.xm +++ b/uYouPlus.xm @@ -269,31 +269,7 @@ static BOOL didFinishLaunching; } %end -// Fix "Google couldn't confirm this attempt to sign in is safe. If you think this is a mistake, you can close and try again to sign in" - qnblackcat/uYouPlus#420 -// Thanks to @AhmedBafkir and @kkirby - https://github.com/qnblackcat/uYouPlus/discussions/447#discussioncomment-3672881 -%group gFixGoogleSignIn -%hook SSORPCService -+ (id)URLFromURL:(id)arg1 withAdditionalFragmentParameters:(NSDictionary *)arg2 { - NSURL *orig = %orig; - NSURLComponents *urlComponents = [[NSURLComponents alloc] initWithURL:orig resolvingAgainstBaseURL:NO]; - NSMutableArray *newQueryItems = [urlComponents.queryItems mutableCopy]; - for (NSURLQueryItem *queryItem in urlComponents.queryItems) { - if ([queryItem.name isEqualToString:@"system_version"] - || [queryItem.name isEqualToString:@"app_version"] - || [queryItem.name isEqualToString:@"kdlc"] - || [queryItem.name isEqualToString:@"kss"] - || [queryItem.name isEqualToString:@"lib_ver"] - || [queryItem.name isEqualToString:@"device_model"]) { - [newQueryItems removeObject:queryItem]; - } - } - urlComponents.queryItems = [newQueryItems copy]; - return urlComponents.URL; -} -%end -%end - -// Hide YouTube Shorts banner in Home page? - @MiRO92 - YTNoShorts: https://github.com/MiRO92/YTNoShorts +// Hide YouTube annoying banner in Home page? - @MiRO92 - YTNoShorts: https://github.com/MiRO92/YTNoShorts %hook YTAsyncCollectionView - (id)cellForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell *cell = %orig; @@ -307,7 +283,6 @@ static BOOL didFinishLaunching; } return %orig; } - %new - (void)removeShortsAndFeaturesAdsAtIndexPath:(NSIndexPath *)indexPath { [self deleteItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]]; @@ -376,6 +351,13 @@ static BOOL didFinishLaunching; return YT_NAME; return %orig; } +// Fix Google Sign in by @PoomSmart and @level3tjg (qnblackcat/uYouPlus#684) +- (NSDictionary *)infoDictionary { + NSMutableDictionary *info = %orig.mutableCopy; + NSString *altBundleIdentifier = info[@"ALTBundleIdentifier"]; + if (altBundleIdentifier) info[@"CFBundleIdentifier"] = altBundleIdentifier; + return info; +} %end // YTMiniPlayerEnabler: https://github.com/level3tjg/YTMiniplayerEnabler/ @@ -463,11 +445,6 @@ static BOOL didFinishLaunching; - (BOOL)respectDeviceCaptionSetting { return NO; } // YouRememberCaption: https://poomsmart.github.io/repo/depictions/youremembercaption.html - (BOOL)isLandscapeEngagementPanelSwipeRightToDismissEnabled { return YES; } // Swipe right to dismiss the right panel in fullscreen mode - (BOOL)mainAppCoreClientIosTransientVisualGlitchInPivotBarFix { return NO; } // Fix uYou's label glitching - qnblackcat/uYouPlus#552 -- (BOOL)enableSwipeToRemoveInPlaylistWatchEp { return YES; } // Enable swipe right to remove video in Playlist. -%end - -%hook YTHotConfig -- (BOOL)iosEnableShortsPlayerSplitViewController { return NO; } // Fix uYou's button missing in Shorts: qnblackcat/uYouPlus#800 %end // NOYTPremium - https://github.com/PoomSmart/NoYTPremium/ @@ -951,10 +928,18 @@ void DEMC_centerRenderingView() { } %end +%hook YTHotConfig +- (BOOL)iosEnableShortsPlayerSplitViewController { + return IsEnabled(@"hideuYouShortsDownloadButton_enabled") ? YES : NO; +} +%end + %hook _ASDisplayView - (void)didMoveToWindow { %orig; - if ((IsEnabled(@"hideBuySuperThanks_enabled")) && ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.suggested_action"])) { self.hidden = YES; } + if ((IsEnabled(@"hideBuySuperThanks_enabled")) && ([self.accessibilityIdentifier isEqualToString:@"id.elements.components.suggested_action"])) { + self.hidden = YES; + } } %end @@ -1027,16 +1012,6 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha: } %end -// Account view controller -// %hook YTAccountPanelBodyViewController -// - (UIColor *)backgroundColor:(NSInteger)pageStyle { -// if (pageStyle == 1) { -// return [UIColor greenColor]; -// } -// return %orig; -// } -// %end - // Explore %hook ASScrollView - (void)didMoveToWindow { @@ -1189,6 +1164,7 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha: if ([self.accessibilityIdentifier isEqualToString:@"id.comment.guidelines_text"]) { self.superview.backgroundColor = [UIColor blackColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_bottom_sheet_container"]) { self.backgroundColor = [UIColor blackColor]; } if ([self.accessibilityIdentifier isEqualToString:@"id.comment.channel_guidelines_entry_banner_container"]) { self.backgroundColor = [UIColor blackColor]; } + if ([self.accessibilityIdentifier isEqualToString:@"id.comment.comment_group_detail_container"]) { self.backgroundColor = [UIColor clearColor]; } } } %end @@ -1325,6 +1301,13 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha: %end %end +// YT startup animation +%hook YTColdConfig +- (BOOL)mainAppCoreClientIosEnableStartupAnimation { + return IsEnabled(@"ytStartupAnimation_enabled") ? YES : NO; +} +%end + # pragma mark - ctor %ctor { // Load uYou first so its functions are available for hooks. @@ -1334,9 +1317,6 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha: if (@available(iOS 16, *)) { %init(iOS16); } - if (!IsEnabled(@"fixGoogleSignIn_enabled")) { - %init(gFixGoogleSignIn); - } if (IsEnabled(@"reExplore_enabled")) { %init(gReExplore); }