From 5a76a9336b54b52e2839fa7eadac3e9af43ce6b8 Mon Sep 17 00:00:00 2001 From: level3tjg Date: Thu, 27 Oct 2022 12:42:06 -0400 Subject: [PATCH] Fix uYou theme bug (#617) --- Header.h | 7 +++++++ uYouPlus.xm | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Header.h b/Header.h index 416ca25..02748b5 100644 --- a/Header.h +++ b/Header.h @@ -1,3 +1,4 @@ +#import "Tweaks/YouTubeHeader/YTAppDelegate.h" #import "Tweaks/YouTubeHeader/YTPlayerViewController.h" #define LOC(x) [tweakBundle localizedStringForKey:x value:nil table:nil] @@ -101,6 +102,12 @@ void center(); - (id)activeVideo; @end +// uYou theme fix +@interface YTAppDelegate () +@property(nonatomic, strong) id downloadsVC; +@end + + // BigYTMiniPlayer @interface YTMainAppVideoPlayerOverlayView : UIView - (UIViewController *)_viewControllerForAncestor; diff --git a/uYouPlus.xm b/uYouPlus.xm index ef00a87..21b92f8 100644 --- a/uYouPlus.xm +++ b/uYouPlus.xm @@ -1101,6 +1101,24 @@ void center() { } %end +// Workaround for qnblackcat/uYouPlus#617 +static BOOL didFinishLaunching; + +%hook YTAppDelegate +- (BOOL)application:(UIApplication *)application + didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + didFinishLaunching = %orig; + self.downloadsVC = [self.downloadsVC init]; + return didFinishLaunching; +} +%end + +%hook DownloadsPagerVC +- (instancetype)init { + return didFinishLaunching ? %orig : self; +} +%end + // iOS 16 uYou crash fix - @level3tjg: https://github.com/qnblackcat/uYouPlus/pull/224 %group iOS16 %hook OBPrivacyLinkButton