From 881d6292aa622cf1d5b73d1938b5e31416223348 Mon Sep 17 00:00:00 2001 From: qnblackcat Date: Mon, 12 Dec 2022 09:28:11 +0700 Subject: [PATCH] Hide search ads by @PoomSmart --- uYouPlus.xm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/uYouPlus.xm b/uYouPlus.xm index 035c72d..03fdb72 100644 --- a/uYouPlus.xm +++ b/uYouPlus.xm @@ -21,6 +21,7 @@ #import "Tweaks/YouTubeHeader/YTReelPlayerBottomButton.h" #import "Tweaks/YouTubeHeader/YTReelPlayerViewController.h" #import "Tweaks/YouTubeHeader/YTAlertView.h" +#import "Tweaks/YouTubeHeader/YTIElementRenderer.h" // Tweak's bundle for Localizations support - @PoomSmart - https://github.com/PoomSmart/YouPiP/commit/aea2473f64c75d73cab713e1e2d5d0a77675024f NSBundle *uYouPlusBundle() { @@ -208,6 +209,29 @@ BOOL dontEatMyContent() { } %end +// Hide search ads by @PoomSmart - https://github.com/PoomSmart/YouTube-X +BOOL didLateHook = NO; + +%group LateHook +%hook YTIElementRenderer +- (NSData *)elementData { + if (self.hasCompatibilityOptions && self.compatibilityOptions.hasAdLoggingData) + return nil; + return %orig; +} +%end +%end + +%hook YTSectionListViewController +- (void)loadWithModel:(id)model { + if (!didLateHook) { + %init(LateHook); + didLateHook = YES; + } + %orig; +} +%end + // Workaround for https://github.com/MiRO92/uYou-for-YouTube/issues/94 %hook UIResponder %new