Merge pull request #1315 from therealFoxster/main
Update DontEatMyContent + reenable uYou appearance patch
This commit is contained in:
commit
707c84608e
2 changed files with 58 additions and 58 deletions
|
|
@ -116,63 +116,63 @@
|
|||
%end
|
||||
|
||||
// Fix uYou's appearance not updating if the app is backgrounded
|
||||
// DownloadsPagerVC *downloadsPagerVC;
|
||||
// NSUInteger selectedTabIndex;
|
||||
// static void refreshUYouAppearance() {
|
||||
// if (!downloadsPagerVC) return;
|
||||
// // View pager
|
||||
// [downloadsPagerVC updatePageStyles];
|
||||
// // Views
|
||||
// for (UIViewController *vc in [downloadsPagerVC viewControllers]) {
|
||||
// if ([vc isKindOfClass:%c(DownloadingVC)]) {
|
||||
// // `Downloading` view
|
||||
// [(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)]) {
|
||||
// // `All`, `Audios`, `Videos`, `Shorts` views
|
||||
// [(DownloadedVC *)vc updatePageStyles];
|
||||
// for (UITableViewCell *cell in [(DownloadedVC *)vc tableView].visibleCells)
|
||||
// if ([cell isKindOfClass:%c(DownloadedCell)])
|
||||
// [(DownloadedCell *)cell updatePageStyles];
|
||||
// }
|
||||
// }
|
||||
// // View pager tabs
|
||||
// for (UIView *subview in [downloadsPagerVC view].subviews) {
|
||||
// if ([subview isKindOfClass:[UIScrollView class]]) {
|
||||
// UIScrollView *tabs = (UIScrollView *)subview;
|
||||
// NSUInteger i = 0;
|
||||
// for (UIView *item in tabs.subviews) {
|
||||
// if ([item isKindOfClass:[UILabel class]]) {
|
||||
// // Tab label
|
||||
// UILabel *tabLabel = (UILabel *)item;
|
||||
// if (i == selectedTabIndex) {} // Selected tab should be excluded
|
||||
// else [tabLabel setTextColor:[UILabel _defaultColor]];
|
||||
// i++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// %hook DownloadsPagerVC
|
||||
// - (instancetype)init {
|
||||
// downloadsPagerVC = %orig;
|
||||
// return downloadsPagerVC;
|
||||
// }
|
||||
// - (void)viewPager:(id)viewPager didChangeTabToIndex:(NSUInteger)arg1 fromTabIndex:(NSUInteger)arg2 {
|
||||
// %orig; selectedTabIndex = arg1;
|
||||
// }
|
||||
// %end
|
||||
|
||||
// %hook UIViewController
|
||||
// - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
|
||||
// %orig;
|
||||
// refreshUYouAppearance();
|
||||
// }
|
||||
// %end
|
||||
static DownloadsPagerVC *downloadsPagerVC;
|
||||
static NSUInteger selectedTabIndex;
|
||||
%hook DownloadsPagerVC
|
||||
- (id)init {
|
||||
downloadsPagerVC = %orig;
|
||||
return downloadsPagerVC;
|
||||
}
|
||||
- (void)viewPager:(id)viewPager didChangeTabToIndex:(NSUInteger)arg1 fromTabIndex:(NSUInteger)arg2 {
|
||||
%orig; selectedTabIndex = arg1;
|
||||
}
|
||||
%end
|
||||
static void refreshUYouAppearance() {
|
||||
if (!downloadsPagerVC) return;
|
||||
// View pager
|
||||
[downloadsPagerVC updatePageStyles];
|
||||
// Views
|
||||
for (UIViewController *vc in [downloadsPagerVC viewControllers]) {
|
||||
if ([vc isKindOfClass:%c(DownloadingVC)]) {
|
||||
// `Downloading` view
|
||||
[(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)]) {
|
||||
// `All`, `Audios`, `Videos`, `Shorts` views
|
||||
[(DownloadedVC *)vc updatePageStyles];
|
||||
for (UITableViewCell *cell in [(DownloadedVC *)vc tableView].visibleCells)
|
||||
if ([cell isKindOfClass:%c(DownloadedCell)])
|
||||
[(DownloadedCell *)cell updatePageStyles];
|
||||
}
|
||||
}
|
||||
// View pager tabs
|
||||
for (UIView *subview in [downloadsPagerVC view].subviews) {
|
||||
if ([subview isKindOfClass:[UIScrollView class]]) {
|
||||
UIScrollView *tabs = (UIScrollView *)subview;
|
||||
NSUInteger i = 0;
|
||||
for (UIView *item in tabs.subviews) {
|
||||
if ([item isKindOfClass:[UILabel class]]) {
|
||||
// Tab label
|
||||
UILabel *tabLabel = (UILabel *)item;
|
||||
if (i == selectedTabIndex) {} // Selected tab should be excluded
|
||||
else [tabLabel setTextColor:[UILabel _defaultColor]];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
%hook UIViewController
|
||||
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
|
||||
%orig;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
refreshUYouAppearance();
|
||||
});
|
||||
}
|
||||
%end
|
||||
|
||||
// Prevent uYou's playback from colliding with YouTube's
|
||||
%hook PlayerVC
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 2253bc34fbb8a5f44993578db37024835bbccdd1
|
||||
Subproject commit 0a68ddc4f78c1c19a0dba03bca426b0f11a98559
|
||||
Loading…
Reference in a new issue