mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-03-11 17:15:32 +00:00
Fix uYou's appearance not updating if the app is backgrounded
This commit is contained in:
parent
ed90d07421
commit
ca9791f732
2 changed files with 53 additions and 1 deletions
|
|
@ -24,4 +24,24 @@
|
|||
// uYou theme fix
|
||||
// @interface YTAppDelegate ()
|
||||
// @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
|
||||
|
||||
// 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 {
|
||||
%init;
|
||||
if (@available(iOS 16, *)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue