Fix uYou's appearance not updating if the app is backgrounded
This commit is contained in:
@@ -25,3 +25,23 @@
|
|||||||
// @interface YTAppDelegate ()
|
// @interface YTAppDelegate ()
|
||||||
// @property(nonatomic, strong) id downloadsVC;
|
// @property(nonatomic, strong) id downloadsVC;
|
||||||
// @end
|
// @end
|
||||||
|
|
||||||
|
// Fix uYou's appearance not updating if the app is backgrounded
|
||||||
|
@interface DownloadsPagerVC : UIViewController
|
||||||
|
- (NSArray<UIViewController *> *)viewControllers;
|
||||||
|
- (void)updatePageStyles;
|
||||||
|
@end
|
||||||
|
@interface DownloadingVC : UIViewController
|
||||||
|
- (void)updatePageStyles;
|
||||||
|
- (UITableView *)tableView;
|
||||||
|
@end
|
||||||
|
@interface DownloadingCell : UITableViewCell
|
||||||
|
- (void)updatePageStyles;
|
||||||
|
@end
|
||||||
|
@interface DownloadedVC : UIViewController
|
||||||
|
- (void)updatePageStyles;
|
||||||
|
- (UITableView *)tableView;
|
||||||
|
@end
|
||||||
|
@interface DownloadedCell : UITableViewCell
|
||||||
|
- (void)updatePageStyles;
|
||||||
|
@end
|
||||||
@@ -102,6 +102,38 @@
|
|||||||
}
|
}
|
||||||
%end
|
%end
|
||||||
|
|
||||||
|
// Fix uYou's appearance not updating if the app is backgrounded
|
||||||
|
DownloadsPagerVC *downloadsPagerVC;
|
||||||
|
static void refreshUYouAppearance() {
|
||||||
|
if (!downloadsPagerVC) return;
|
||||||
|
[downloadsPagerVC updatePageStyles];
|
||||||
|
for (UIViewController *vc in [downloadsPagerVC viewControllers]) {
|
||||||
|
if ([vc isKindOfClass:%c(DownloadingVC)]) {
|
||||||
|
[(DownloadingVC *)vc updatePageStyles];
|
||||||
|
for (UITableViewCell *cell in [(DownloadingVC *)vc tableView].visibleCells)
|
||||||
|
if ([cell isKindOfClass:%c(DownloadingCell)])
|
||||||
|
[(DownloadingCell *)cell updatePageStyles];
|
||||||
|
} else if ([vc isKindOfClass:%c(DownloadedVC)]) {
|
||||||
|
[(DownloadedVC *)vc updatePageStyles];
|
||||||
|
for (UITableViewCell *cell in [(DownloadedVC *)vc tableView].visibleCells)
|
||||||
|
if ([cell isKindOfClass:%c(DownloadedCell)])
|
||||||
|
[(DownloadedCell *)cell updatePageStyles];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%hook DownloadsPagerVC
|
||||||
|
- (instancetype)init {
|
||||||
|
downloadsPagerVC = %orig;
|
||||||
|
return downloadsPagerVC;
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
%hook UIViewController
|
||||||
|
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
|
||||||
|
%orig;
|
||||||
|
refreshUYouAppearance();
|
||||||
|
}
|
||||||
|
%end
|
||||||
|
|
||||||
%ctor {
|
%ctor {
|
||||||
%init;
|
%init;
|
||||||
if (@available(iOS 16, *)) {
|
if (@available(iOS 16, *)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user