diff --git a/Sources/uYouPlus.h b/Sources/uYouPlus.h index 9fd7edc..0cd083d 100644 --- a/Sources/uYouPlus.h +++ b/Sources/uYouPlus.h @@ -33,7 +33,6 @@ #import #import #import -#import // Hide buttons under the video player by @PoomSmart #import @@ -73,49 +72,40 @@ // Hide Premium Promo in You tab - @bhackel @interface YTIIconThumbnailRenderer : GPBMessage -@property (nonatomic, strong) YTIIcon *icon; -- (bool)hasIcon; + @property (nonatomic, strong) YTIIcon *icon; + - (bool)hasIcon; @end @interface YTICompactListItemThumbnailSupportedRenderers : GPBMessage -@property (nonatomic, strong) YTIIconThumbnailRenderer *iconThumbnailRenderer; -- (bool)hasIconThumbnailRenderer; + @property (nonatomic, strong) YTIIconThumbnailRenderer *iconThumbnailRenderer; + - (bool)hasIconThumbnailRenderer; @end @interface YTICompactListItemRenderer : GPBMessage -@property (nonatomic, strong) YTICompactListItemThumbnailSupportedRenderers *thumbnail; -@property (nonatomic, strong) YTIFormattedString *title; -- (bool)hasThumbnail; -- (bool)hasTitle; + @property (nonatomic, strong) YTICompactListItemThumbnailSupportedRenderers *thumbnail; + @property (nonatomic, strong) YTIFormattedString *title; + - (bool)hasThumbnail; + - (bool)hasTitle; @end @interface YTIIcon (uYouEnhanced) -- (bool)hasIconType; + - (bool)hasIconType; @end @interface YTICompactLinkRenderer : GPBMessage -@property (nonatomic, strong) YTIIcon *icon; -@property (nonatomic, strong) YTIFormattedString *title; -@property (nonatomic, strong) YTICompactListItemThumbnailSupportedRenderers *thumbnail; -- (bool)hasIcon; -- (bool)hasThumbnail; + @property (nonatomic, strong) YTIIcon *icon; + @property (nonatomic, strong) YTIFormattedString *title; + @property (nonatomic, strong) YTICompactListItemThumbnailSupportedRenderers *thumbnail; + - (bool)hasIcon; + - (bool)hasThumbnail; @end @interface YTIItemSectionSupportedRenderers (uYouEnhanced) -@property(readonly, nonatomic) YTICompactLinkRenderer *compactLinkRenderer; -@property(readonly, nonatomic) YTICompactListItemRenderer *compactListItemRenderer; -- (bool)hasCompactLinkRenderer; -- (bool)hasCompactListItemRenderer; + @property(readonly, nonatomic) YTICompactLinkRenderer *compactLinkRenderer; + @property(readonly, nonatomic) YTICompactListItemRenderer *compactListItemRenderer; + - (bool)hasCompactLinkRenderer; + - (bool)hasCompactListItemRenderer; @end @interface YTAppCollectionViewController : YTInnerTubeCollectionViewController - (void)uYouEnhancedFakePremiumModel:(YTISectionListRenderer *)model; @end @interface YTInnerTubeCollectionViewController (uYouEnhanced) -@property(readonly, nonatomic) YTISectionListRenderer *model; -@end -@interface YTLinkCell : UICollectionViewCell -@end -@interface YTCompactListItemCellController : YTCellController -@property(nonatomic, weak, readwrite) id entry; -@end -@interface GLViewPagerViewController : UIViewController -@end -@interface DownloadsPagerVC : GLViewPagerViewController + @property(readonly, nonatomic) YTISectionListRenderer *model; @end // uYouPlus diff --git a/Sources/uYouPlus.xm b/Sources/uYouPlus.xm index 15a533b..9d67e34 100644 --- a/Sources/uYouPlus.xm +++ b/Sources/uYouPlus.xm @@ -359,6 +359,7 @@ BOOL isAd(YTIElementRenderer *self) { if (yourVideosCellIndex != -1 && subContentsArray[yourVideosCellIndex].accessibilityLabel == nil) { // Create the fake Downloads page by copying the Your Videos page and modifying it // Note that this must be done outside the loop to avoid a runtime exception + // TODO Link this to the uYou downloads page YTIItemSectionSupportedRenderers *newItemSectionSupportedRenderers = [subContentsArray[yourVideosCellIndex] copy]; ((YTIStringRun *)(newItemSectionSupportedRenderers.compactListItemRenderer.title.runsArray.firstObject)).text = LOC(@"FAKE_DOWNLOADS"); newItemSectionSupportedRenderers.compactListItemRenderer.thumbnail.iconThumbnailRenderer.icon.iconType = 147; @@ -367,8 +368,6 @@ BOOL isAd(YTIElementRenderer *self) { // Inject a note to not modify this again subContentsArray[yourVideosCellIndex].accessibilityLabel = @"uYouEnhanced Modified"; yourVideosCellIndex = -1; - // Insert accessibility info into the YTLinkCell so that it can be hooked later - newItemSectionSupportedRenderers.compactListItemRenderer.title.accessibility.accessibilityData.label = @"uYouEnhanced Fake Downloads"; } } } @@ -383,44 +382,6 @@ BOOL isAd(YTIElementRenderer *self) { %orig; } %end -// Change the destination of the fake Downloads cell -%hook YTCompactListItemCellController -- (void)didSelectItem { - NSLog(@"bhackel: _handleMenuGesture"); - id entry = self.entry; - // Avoid modifying the wrong things - if (![entry isKindOfClass:NSClassFromString(@"YTICompactListItemRenderer")]) { - %orig; - return; - } - YTICompactListItemRenderer *compactListItemRenderer = (YTICompactListItemRenderer *)entry; - // Check title for accessibility label that was stored - if ([compactListItemRenderer.title.accessibility.accessibilityData.label isEqualToString:@"uYouEnhanced Fake Downloads"]) { - NSLog(@"bhackel: uYouEnhanced Fake Downloads"); - // Chatgpt generated code to show DownloadsPagerVC, which is the uYou page - // Instantiate your custom DownloadsPagerVC - // Avoid linker stuff - Class downloadsPagerVCClass = objc_getClass("DownloadsPagerVC"); - if (downloadsPagerVCClass) { - id downloadsPagerVCid = [[downloadsPagerVCClass alloc] init]; - // Now you can use `downloadsPagerVC` as needed - } - DownloadsPagerVC *downloadsPagerVC = (DownloadsPagerVC *)downloadsPagerVCid; - // Assuming you need navigation controller to push - UIViewController *rootViewController = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; - UINavigationController *navigationController = (UINavigationController *)rootViewController; - if ([navigationController isKindOfClass:[UINavigationController class]]) { - [navigationController pushViewController:downloadsPagerVC animated:YES]; - } else { - // If not in a navigation controller context, present modally - [rootViewController presentViewController:downloadsPagerVC animated:YES completion:nil]; - } - } else { - NSLog(@"bhackel: Not uYouEnhanced Fake Downloads"); - %orig; - } -} -%end %end diff --git a/Sources/uYouPlusPatches.h b/Sources/uYouPlusPatches.h index 9bf3238..a9231b6 100644 --- a/Sources/uYouPlusPatches.h +++ b/Sources/uYouPlusPatches.h @@ -32,7 +32,7 @@ // @end // Fix uYou's appearance not updating if the app is backgrounded -@interface DownloadsPagerVC (uYouEnhancedPatches) +@interface DownloadsPagerVC : UIViewController - (NSArray *)viewControllers; - (void)updatePageStyles; @end