This commit is contained in:
Nguyễn Đạt
2022-09-28 10:52:39 +07:00
committed by GitHub
parent b56461a439
commit 2657f8ca7c
+14 -17
View File
@@ -881,9 +881,7 @@ static void replaceTab(YTIGuideResponse *response) {
%end
%end
#define UNSUPPORTED_DEVICES @[@"iPhone14,3", @"iPhone14,6", @"iPhone14,8"]
#define THRESHOLD 1.99
// DontEatMyContent - @therealFoxster: https://github.com/therealFoxster/DontEatMyContent
double aspectRatio = 16/9;
bool zoomedToFill = false;
@@ -892,7 +890,6 @@ NSLayoutConstraint *widthConstraint, *heightConstraint, *centerXConstraint, *cen
%group gDontEatMyContent
%hook YTPlayerViewController
- (void)viewDidAppear:(BOOL)animated {
YTPlayerView *playerView = [self playerView];
UIView *renderingViewContainer = MSHookIvar<UIView *>(playerView, "_renderingViewContainer");
@@ -917,6 +914,7 @@ NSLayoutConstraint *widthConstraint, *heightConstraint, *centerXConstraint, *cen
} else {
center();
}
%orig(animated);
}
- (void)didPressToggleFullscreen {
@@ -958,26 +956,25 @@ NSLayoutConstraint *widthConstraint, *heightConstraint, *centerXConstraint, *cen
zoomedToFill = true;
deactivate();
}
%orig(pinchGestureRecognizer);
}
- (void)flashAndHideSnapIndicator {}
// https://github.com/lgariv/UniZoom/blob/master/Tweak.xm
- (void)setSnapIndicatorVisible:(bool)arg1 {
%orig(NO);
}
%end
%end
%end // gDontEatMyContent
// DontEatMycontent - detecting device model
// https://stackoverflow.com/a/11197770/19227228
NSString* deviceName() {
NSString* deviceName() {
struct utsname systemInfo;
uname(&systemInfo);
return [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
}
}
BOOL isDeviceSupported() {
BOOL isDeviceSupported() {
NSString *identifier = deviceName();
NSArray *unsupportedDevices = UNSUPPORTED_DEVICES;
@@ -996,29 +993,29 @@ NSLayoutConstraint *widthConstraint, *heightConstraint, *centerXConstraint, *cen
return YES;
} else return NO;
} else return NO;
}
}
void activate() {
void activate() {
if (aspectRatio < THRESHOLD || zoomedToFill) return;
// NSLog(@"activate");
center();
renderingView.translatesAutoresizingMaskIntoConstraints = NO;
widthConstraint.active = YES;
heightConstraint.active = YES;
}
}
void deactivate() {
void deactivate() {
// NSLog(@"deactivate");
center();
renderingView.translatesAutoresizingMaskIntoConstraints = YES;
widthConstraint.active = NO;
heightConstraint.active = NO;
}
}
void center() {
void center() {
centerXConstraint.active = YES;
centerYConstraint.active = YES;
}
}
// iOS 16 uYou crash fix - @level3tjg: https://github.com/qnblackcat/uYouPlus/pull/224
%group iOS16