mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-03-11 21:26:04 +00:00
Update uYouPlusPatches.xm (from uYouPlus)
Added the same changes from uYouPlus.
This commit is contained in:
parent
1b8ddd322b
commit
5db8890b05
1 changed files with 53 additions and 48 deletions
|
|
@ -92,36 +92,36 @@ static void repositionCreateTab(YTIGuideResponse *response) {
|
|||
%end
|
||||
|
||||
// iOS 16 uYou crash fix - @level3tjg: https://github.com/qnblackcat/uYouPlus/pull/224
|
||||
%group iOS16
|
||||
%hook OBPrivacyLinkButton
|
||||
%new
|
||||
- (instancetype)initWithCaption:(NSString *)caption
|
||||
buttonText:(NSString *)buttonText
|
||||
image:(UIImage *)image
|
||||
imageSize:(CGSize)imageSize
|
||||
useLargeIcon:(BOOL)useLargeIcon {
|
||||
return [self initWithCaption:caption
|
||||
buttonText:buttonText
|
||||
image:image
|
||||
imageSize:imageSize
|
||||
useLargeIcon:useLargeIcon
|
||||
displayLanguage:[NSLocale currentLocale].languageCode];
|
||||
}
|
||||
%end
|
||||
%end
|
||||
// %group iOS16
|
||||
// %hook OBPrivacyLinkButton
|
||||
// %new
|
||||
// - (instancetype)initWithCaption:(NSString *)caption
|
||||
// buttonText:(NSString *)buttonText
|
||||
// image:(UIImage *)image
|
||||
// imageSize:(CGSize)imageSize
|
||||
// useLargeIcon:(BOOL)useLargeIcon {
|
||||
// return [self initWithCaption:caption
|
||||
// buttonText:buttonText
|
||||
// image:image
|
||||
// imageSize:imageSize
|
||||
// useLargeIcon:useLargeIcon
|
||||
// displayLanguage:[NSLocale currentLocale].languageCode];
|
||||
// }
|
||||
// %end
|
||||
// %end
|
||||
|
||||
// Fix uYou playback speed crashes YT v18.49.3+, see https://github.com/iCrazeiOS/uYouCrashFix
|
||||
%hook YTPlayerViewController
|
||||
%new
|
||||
-(float)currentPlaybackRateForVarispeedSwitchController:(id)arg1 {
|
||||
return [[self activeVideo] playbackRate];
|
||||
}
|
||||
// %hook YTPlayerViewController
|
||||
// %new
|
||||
// -(float)currentPlaybackRateForVarispeedSwitchController:(id)arg1 {
|
||||
// return [[self activeVideo] playbackRate];
|
||||
// }
|
||||
|
||||
%new
|
||||
-(void)varispeedSwitchController:(id)arg1 didSelectRate:(float)arg2 {
|
||||
[[self activeVideo] setPlaybackRate:arg2];
|
||||
}
|
||||
%end
|
||||
// %new
|
||||
// -(void)varispeedSwitchController:(id)arg1 didSelectRate:(float)arg2 {
|
||||
// [[self activeVideo] setPlaybackRate:arg2];
|
||||
// }
|
||||
// %end
|
||||
|
||||
// Fix streched artwork in uYou's player view - https://github.com/MiRO92/uYou-for-YouTube/issues/287
|
||||
%hook ArtworkImageView
|
||||
|
|
@ -146,8 +146,17 @@ static void repositionCreateTab(YTIGuideResponse *response) {
|
|||
%end
|
||||
|
||||
// Fix uYou's appearance not updating if the app is backgrounded
|
||||
DownloadsPagerVC *downloadsPagerVC;
|
||||
NSUInteger selectedTabIndex;
|
||||
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
|
||||
|
|
@ -186,31 +195,27 @@ static void refreshUYouAppearance() {
|
|||
}
|
||||
}
|
||||
}
|
||||
%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();
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
refreshUYouAppearance();
|
||||
});
|
||||
}
|
||||
%end
|
||||
|
||||
// Prevent uYou's playback from colliding with YouTube's
|
||||
BOOL isYTPlaybackActive = NO;
|
||||
%hook HAMPlayerInternal
|
||||
- (void)play { %orig; isYTPlaybackActive = YES; }
|
||||
- (void)terminate { %orig; isYTPlaybackActive = NO; }
|
||||
%hook PlayerVC
|
||||
- (void)close {
|
||||
%orig;
|
||||
[[%c(PlayerManager) sharedInstance] setSource:nil];
|
||||
}
|
||||
%end
|
||||
%hook PlayerManager
|
||||
%hook HAMPlayerInternal
|
||||
- (void)play {
|
||||
if (isYTPlaybackActive) return;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[%c(PlayerManager) sharedInstance] pause];
|
||||
});
|
||||
%orig;
|
||||
}
|
||||
%end
|
||||
|
|
@ -223,9 +228,9 @@ BOOL isYTPlaybackActive = NO;
|
|||
|
||||
%ctor {
|
||||
%init;
|
||||
if (@available(iOS 16, *)) {
|
||||
%init(iOS16);
|
||||
}
|
||||
// if (@available(iOS 16, *)) {
|
||||
// %init(iOS16);
|
||||
// }
|
||||
|
||||
// Disable broken options
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue