This commit is contained in:
qnblackcat
2023-04-28 00:32:33 +07:00
parent c47195b47e
commit 52ac2585bd
+29 -20
View File
@@ -32,14 +32,14 @@ static BOOL oldDarkTheme() {
// //
# pragma mark - uYou's patches # pragma mark - uYou's patches
// Workaround for qnblackcat/uYouPlus#10 // Workaround for qnblackcat/uYouPlus#10
// %hook boolSettingsVC %hook boolSettingsVC
// - (instancetype)initWithTitle:(NSString *)title sections:(NSArray *)sections footer:(NSString *)footer { - (instancetype)initWithTitle:(NSString *)title sections:(NSArray *)sections footer:(NSString *)footer {
// if (@available(iOS 15, *)) if (@available(iOS 15, *))
// if (![self valueForKey:@"_lastNotifiedTraitCollection"]) if (![self valueForKey:@"_lastNotifiedTraitCollection"])
// [self setValue:[UITraitCollection currentTraitCollection] forKey:@"_lastNotifiedTraitCollection"]; [self setValue:[UITraitCollection currentTraitCollection] forKey:@"_lastNotifiedTraitCollection"];
// return %orig; return %orig;
// } }
// %end %end
// Prevent uYou player bar from showing when not playing downloaded media // Prevent uYou player bar from showing when not playing downloaded media
%hook PlayerManager %hook PlayerManager
@@ -248,18 +248,27 @@ static BOOL didFinishLaunching;
} }
%end %end
%hook YTSectionListViewController // Hide search ads by @PoomSmart - https://github.com/PoomSmart/YouTube-X
- (void)loadWithModel:(YTISectionListRenderer *)model { // %hook YTIElementRenderer
NSMutableArray <YTISectionListSupportedRenderers *> *contentsArray = model.contentsArray; // - (NSData *)elementData {
NSIndexSet *removeIndexes = [contentsArray indexesOfObjectsPassingTest:^BOOL(YTISectionListSupportedRenderers *renderers, NSUInteger idx, BOOL *stop) { // if (self.hasCompatibilityOptions && self.compatibilityOptions.hasAdLoggingData)
YTIItemSectionRenderer *sectionRenderer = renderers.itemSectionRenderer; // return nil;
YTIItemSectionSupportedRenderers *firstObject = [sectionRenderer.contentsArray firstObject]; // return %orig;
return firstObject.hasPromotedVideoRenderer || firstObject.hasCompactPromotedVideoRenderer || firstObject.hasPromotedVideoInlineMutedRenderer; // }
}]; // %end
[contentsArray removeObjectsAtIndexes:removeIndexes];
%orig; // %hook YTSectionListViewController
} // - (void)loadWithModel:(YTISectionListRenderer *)model {
%end // NSMutableArray <YTISectionListSupportedRenderers *> *contentsArray = model.contentsArray;
// NSIndexSet *removeIndexes = [contentsArray indexesOfObjectsPassingTest:^BOOL(YTISectionListSupportedRenderers *renderers, NSUInteger idx, BOOL *stop) {
// YTIItemSectionRenderer *sectionRenderer = renderers.itemSectionRenderer;
// YTIItemSectionSupportedRenderers *firstObject = [sectionRenderer.contentsArray firstObject];
// return firstObject.hasPromotedVideoRenderer || firstObject.hasCompactPromotedVideoRenderer || firstObject.hasPromotedVideoInlineMutedRenderer;
// }];
// [contentsArray removeObjectsAtIndexes:removeIndexes];
// %orig;
// }
// %end
// YTClassicVideoQuality: https://github.com/PoomSmart/YTClassicVideoQuality // YTClassicVideoQuality: https://github.com/PoomSmart/YTClassicVideoQuality
%hook YTVideoQualitySwitchControllerFactory %hook YTVideoQualitySwitchControllerFactory