From 6300fd4cac5f8f038c2d79620d02a68dd3e6f6b3 Mon Sep 17 00:00:00 2001 From: arichornlover <78001398+arichornlover@users.noreply.github.com> Date: Tue, 23 Jul 2024 10:59:21 -0500 Subject: [PATCH 1/5] Update .gitmodules --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index be5e66c..bcfec37 100644 --- a/.gitmodules +++ b/.gitmodules @@ -45,7 +45,7 @@ url = https://github.com/Muirey03/RemoteLog [submodule "Tweaks/DontEatMyContent"] path = Tweaks/DontEatMyContent - url = https://github.com/therealFoxster/DontEatMyContent + url = https://github.com/arichornloverALT/DontEatMyContent [submodule "Tweaks/iSponsorBlock"] path = Tweaks/iSponsorBlock url = https://github.com/Galactic-Dev/iSponsorBlock.git From d16a0ec73d08e625e90e9c55827b9ac98a66a82c Mon Sep 17 00:00:00 2001 From: arichornlover <78001398+arichornlover@users.noreply.github.com> Date: Tue, 30 Jul 2024 11:33:02 -0500 Subject: [PATCH 2/5] Update YouTube-native-share to 0.2.3 & re-added Google Sign In Fix --- Sources/uYouPlusPatches.xm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Sources/uYouPlusPatches.xm b/Sources/uYouPlusPatches.xm index 7540250..cbab506 100644 --- a/Sources/uYouPlusPatches.xm +++ b/Sources/uYouPlusPatches.xm @@ -2,8 +2,8 @@ # pragma mark - YouTube patches -/* // Fix Google Sign in by @PoomSmart and @level3tjg (qnblackcat/uYouPlus#684) +%group gGoogleSignInPatch %hook NSBundle - (NSDictionary *)infoDictionary { NSMutableDictionary *info = %orig.mutableCopy; @@ -12,7 +12,7 @@ return info; } %end -*/ +%end // Workaround for MiRO92/uYou-for-YouTube#12, qnblackcat/uYouPlus#263 %hook YTDataUtils @@ -98,6 +98,7 @@ typedef NS_ENUM(NSInteger, ShareEntityType) { ShareEntityFieldVideo = 1, ShareEntityFieldPlaylist = 2, ShareEntityFieldChannel = 3, + ShareEntityFieldPost = 6, ShareEntityFieldClip = 8 }; @@ -110,6 +111,7 @@ static inline NSString* extractIdWithFormat(GPBUnknownFieldSet *fields, NSIntege NSString *id = [[NSString alloc] initWithData:[idField.lengthDelimitedList firstObject] encoding:NSUTF8StringEncoding]; return [NSString stringWithFormat:format, id]; } + static BOOL showNativeShareSheet(NSString *serializedShareEntity, UIView *sourceView) { GPBMessage *shareEntity = [%c(GPBMessage) deserializeFromString:serializedShareEntity]; GPBUnknownFieldSet *fields = shareEntity.unknownFields; @@ -138,6 +140,9 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity, UIView *source if (!shareUrl) shareUrl = extractIdWithFormat(fields, ShareEntityFieldVideo, @"https://youtube.com/watch?v=%@"); + if (!shareUrl) + shareUrl = extractIdWithFormat(fields, ShareEntityFieldPost, @"https://youtube.com/post/%@"); + if (!shareUrl) return NO; @@ -166,7 +171,7 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity, UIView *source YTIShareEntityEndpoint *shareEntityEndpoint = [self.command getExtension:shareEntityEndpointDescriptor]; if (!shareEntityEndpoint.hasSerializedShareEntity) return %orig; - if (!showNativeShareSheet(shareEntityEndpoint.serializedShareEntity, self.fromView)) + if (!showNativeShareSheet(shareEntityEndpoint.serializedShareEntity)) return %orig; } %end @@ -174,7 +179,7 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity, UIView *source /* ------------------- iPhone Layout ------------------- */ %hook ELMPBShowActionSheetCommand -- (void)executeWithCommandContext:(ELMCommandContext*)context handler:(id)_handler { +- (void)executeWithCommandContext:(id)_context handler:(id)_handler { if (!self.hasOnAppear) return %orig; GPBExtensionDescriptor *innertubeCommandDescriptor = [%c(YTIInnertubeCommandExtensionRoot) innertubeCommand]; @@ -187,7 +192,7 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity, UIView *source YTIUpdateShareSheetCommand *updateShareSheetCommand = [innertubeCommand getExtension:updateShareSheetCommandDescriptor]; if (!updateShareSheetCommand.hasSerializedShareEntity) return %orig; - if (!showNativeShareSheet(updateShareSheetCommand.serializedShareEntity, context.context.fromView)) + if (!showNativeShareSheet(updateShareSheetCommand.serializedShareEntity)) return %orig; } %end @@ -331,6 +336,9 @@ static void refreshUYouAppearance() { %ctor { %init; + if (IS_ENABLED(@"googleSignInPatch_enabled")) { + %init(gGoogleSignInPatch); + } // if (@available(iOS 16, *)) { // %init(iOS16); // } From e91b64b2488dd0a6ac6fbffe2ca50c4424f3e52e Mon Sep 17 00:00:00 2001 From: arichornlover <78001398+arichornlover@users.noreply.github.com> Date: Tue, 30 Jul 2024 11:35:59 -0500 Subject: [PATCH 3/5] Re-add missing youtube-native-share 0.2.3 I accidentally reverted this. It should still work as intended. --- Sources/uYouPlusPatches.xm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Sources/uYouPlusPatches.xm b/Sources/uYouPlusPatches.xm index cbab506..95e9acc 100644 --- a/Sources/uYouPlusPatches.xm +++ b/Sources/uYouPlusPatches.xm @@ -171,15 +171,16 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity, UIView *source YTIShareEntityEndpoint *shareEntityEndpoint = [self.command getExtension:shareEntityEndpointDescriptor]; if (!shareEntityEndpoint.hasSerializedShareEntity) return %orig; - if (!showNativeShareSheet(shareEntityEndpoint.serializedShareEntity)) + if (!showNativeShareSheet(shareEntityEndpoint.serializedShareEntity, self.fromView)) return %orig; } %end + /* ------------------- iPhone Layout ------------------- */ %hook ELMPBShowActionSheetCommand -- (void)executeWithCommandContext:(id)_context handler:(id)_handler { +- (void)executeWithCommandContext:(ELMCommandContext*)context handler:(id)_handler { if (!self.hasOnAppear) return %orig; GPBExtensionDescriptor *innertubeCommandDescriptor = [%c(YTIInnertubeCommandExtensionRoot) innertubeCommand]; @@ -192,7 +193,7 @@ static BOOL showNativeShareSheet(NSString *serializedShareEntity, UIView *source YTIUpdateShareSheetCommand *updateShareSheetCommand = [innertubeCommand getExtension:updateShareSheetCommandDescriptor]; if (!updateShareSheetCommand.hasSerializedShareEntity) return %orig; - if (!showNativeShareSheet(updateShareSheetCommand.serializedShareEntity)) + if (!showNativeShareSheet(updateShareSheetCommand.serializedShareEntity, context.context.fromView)) return %orig; } %end From c08e2fcfd5aacc746b38c725e128e31980d2dd3f Mon Sep 17 00:00:00 2001 From: arichornlover <78001398+arichornlover@users.noreply.github.com> Date: Tue, 30 Jul 2024 15:27:56 -0500 Subject: [PATCH 4/5] Update YouTube-X (uYouPlus.xm) --- Sources/uYouPlus.xm | 89 ++++++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 41 deletions(-) diff --git a/Sources/uYouPlus.xm b/Sources/uYouPlus.xm index bd9f160..5bd4753 100644 --- a/Sources/uYouPlus.xm +++ b/Sources/uYouPlus.xm @@ -105,6 +105,14 @@ NSBundle *tweakBundle = uYouPlusBundle(); - (void)decorateContext:(id)context { %orig(nil); } %end +%hook YTLocalPlaybackController +- (id)createAdsPlaybackCoordinator { return nil; } +%end + +%hook MDXSession +- (void)adPlaying:(id)ad {} +%end + %hook YTReelInfinitePlaybackDataSource - (void)setReels:(NSMutableOrderedSet *)reels { [reels removeObjectsAtIndexes:[reels indexesOfObjectsPassingTest:^BOOL(YTReelModel *obj, NSUInteger idx, BOOL *stop) { @@ -138,6 +146,12 @@ NSBundle *tweakBundle = uYouPlusBundle(); %hook YTAccountScopedAdsInnerTubeContextDecorator - (void)decorateContext:(id)context { %orig(nil); } %end +%hook YTLocalPlaybackController +- (id)createAdsPlaybackCoordinator { return nil; } +%end +%hook MDXSession +- (void)adPlaying:(id)ad {} +%end %hook YTReelInfinitePlaybackDataSource - (void)setReels:(NSMutableOrderedSet *)reels { [reels removeObjectsAtIndexes:[reels indexesOfObjectsPassingTest:^BOOL(YTReelModel *obj, NSUInteger idx, BOOL *stop) { @@ -147,8 +161,6 @@ NSBundle *tweakBundle = uYouPlusBundle(); } %end NSString *getAdString(NSString *description) { - if ([description containsString:@"ad_layout"]) - return @"ad_layout"; if ([description containsString:@"brand_promo"]) return @"brand_promo"; if ([description containsString:@"carousel_footered_layout"]) @@ -185,53 +197,48 @@ NSString *getAdString(NSString *description) { return @"video_display_full_buttoned_layout"; return nil; } -static __strong NSData *cellDividerData; -%hook YTIElementRenderer -- (NSData *)elementData { - NSString *description = [self description]; - if ([description containsString:@"cell_divider"]) { - if (!cellDividerData) cellDividerData = %orig; - return cellDividerData; - } - if (!cellDividerData) return %orig; - if ([self respondsToSelector:@selector(hasCompatibilityOptions)] && self.hasCompatibilityOptions && self.compatibilityOptions.hasAdLoggingData) { - HBLogDebug(@"YTX adLogging 1 %@", cellDividerData); - return cellDividerData; +static BOOL isAdRenderer(YTIElementRenderer *elementRenderer, int kind) { + if ([elementRenderer respondsToSelector:@selector(hasCompatibilityOptions)] && elementRenderer.hasCompatibilityOptions && elementRenderer.compatibilityOptions.hasAdLoggingData) { + HBLogDebug(@"YTX adLogging %d %@", kind, elementRenderer); + return YES; } + NSString *description = [elementRenderer description]; NSString *adString = getAdString(description); if (adString) { - HBLogDebug(@"YTX getAdString 1 %@ %@", adString, cellDividerData); - return cellDividerData; + HBLogDebug(@"YTX getAdString %d %@ %@", kind, adString, elementRenderer); + return YES; } - return %orig; + return NO; } -%end -%hook YTInnerTubeCollectionViewController -- (void)loadWithModel:(YTISectionListRenderer *)model { - if ([model isKindOfClass:%c(YTISectionListRenderer)]) { - NSMutableArray *contentsArray = model.contentsArray; - NSIndexSet *removeIndexes = [contentsArray indexesOfObjectsPassingTest:^BOOL(YTISectionListSupportedRenderers *renderers, NSUInteger idx, BOOL *stop) { - if (![renderers isKindOfClass:%c(YTISectionListSupportedRenderers)]) - return NO; - YTIItemSectionRenderer *sectionRenderer = renderers.itemSectionRenderer; - YTIItemSectionSupportedRenderers *firstObject = [sectionRenderer.contentsArray firstObject]; - YTIElementRenderer *elementRenderer = firstObject.elementRenderer; - if ([elementRenderer respondsToSelector:@selector(hasCompatibilityOptions)] && elementRenderer.hasCompatibilityOptions && elementRenderer.compatibilityOptions.hasAdLoggingData) { - HBLogDebug(@"YTX adLogging 2 %@", elementRenderer); - return YES; - } - NSString *description = [elementRenderer description]; - NSString *adString = getAdString(description); - if (adString) { - HBLogDebug(@"YTX getAdString 2 %@ %@", adString, elementRenderer); - return YES; - } +static NSMutableArray *filteredArray(NSArray *array) { + NSMutableArray *newArray = [array mutableCopy]; + NSIndexSet *removeIndexes = [newArray indexesOfObjectsPassingTest:^BOOL(YTIItemSectionRenderer *sectionRenderer, NSUInteger idx, BOOL *stop) { + if (![sectionRenderer isKindOfClass:%c(YTIItemSectionRenderer)]) return NO; - }]; - [contentsArray removeObjectsAtIndexes:removeIndexes]; - } + NSMutableArray *contentsArray = sectionRenderer.contentsArray; + if (contentsArray.count > 1) { + NSIndexSet *removeContentsArrayIndexes = [contentsArray indexesOfObjectsPassingTest:^BOOL(YTIItemSectionSupportedRenderers *sectionSupportedRenderers, NSUInteger idx2, BOOL *stop2) { + YTIElementRenderer *elementRenderer = sectionSupportedRenderers.elementRenderer; + return isAdRenderer(elementRenderer, 3); + }]; + [contentsArray removeObjectsAtIndexes:removeContentsArrayIndexes]; + } + YTIItemSectionSupportedRenderers *firstObject = [contentsArray firstObject]; + YTIElementRenderer *elementRenderer = firstObject.elementRenderer; + return isAdRenderer(elementRenderer, 2); + }]; + [newArray removeObjectsAtIndexes:removeIndexes]; + return newArray; +} +%hook YTInnerTubeCollectionViewController +- (void)displaySectionsWithReloadingSectionControllerByRenderer:(id)renderer { + NSMutableArray *sectionRenderers = [self valueForKey:@"_sectionRenderers"]; + [self setValue:filteredArray(sectionRenderers) forKey:@"_sectionRenderers"]; %orig; } +- (void)addSectionsFromArray:(NSArray *)array { + %orig(filteredArray(array)); +} %end %end From 064774b9110de80c10948a9e939625629f2f7beb Mon Sep 17 00:00:00 2001 From: arichornlover <78001398+arichornlover@users.noreply.github.com> Date: Thu, 1 Aug 2024 00:54:03 -0500 Subject: [PATCH 5/5] =?UTF-8?q?Added=20new=20option=20=E2=80=9CYouTube=20S?= =?UTF-8?q?ign-In=20Patch=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/uYouPlusSettings.xm | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/uYouPlusSettings.xm b/Sources/uYouPlusSettings.xm index 76dd5c5..d08491d 100644 --- a/Sources/uYouPlusSettings.xm +++ b/Sources/uYouPlusSettings.xm @@ -1340,6 +1340,7 @@ extern NSBundle *uYouPlusBundle(); # pragma mark - Miscellaneous SECTION_HEADER(LOC(@"MISCELLANEOUS")); + SWITCH_ITEM2(LOC(@"YouTube Sign-In Patch"), LOC(@"When enabled, it will allow you to sign in on the YouTube App when sideloaded.\nUnwanted Side Effects: Most Icons in the app will be Invisible & Notifications might not work."), @"googleSignInPatch_enabled"); SWITCH_ITEM2(LOC(@"ADBLOCK_WORKAROUND_LITE"), LOC(@"ADBLOCK_WORKAROUND_LITE_DESC"), @"uYouAdBlockingWorkaroundLite_enabled"); SWITCH_ITEM2(LOC(@"ADBLOCK_WORKAROUND"), LOC(@"ADBLOCK_WORKAROUND_DESC"), @"uYouAdBlockingWorkaround_enabled"); SWITCH_ITEM3(