Allow feature for portrait videos

This commit is contained in:
Bryce Hackel 2024-04-10 23:06:20 -07:00
parent cc38d49f2e
commit a43f8ff13e
No known key found for this signature in database
GPG key ID: F031960F08455E88
2 changed files with 31 additions and 4 deletions

View file

@ -30,6 +30,7 @@
#import <YouTubeHeader/YTInnerTubeCollectionViewController.h>
#import <YouTubeHeader/YTPivotBarItemView.h>
#import <YouTubeHeader/YTCollectionViewCell.h>
#import <YouTubeHeader/YTWatchViewController.h>
// Hide buttons under the video player by @PoomSmart
#import <YouTubeHeader/ASCollectionElement.h>
@ -67,6 +68,15 @@
@property(readonly, nonatomic) YTIIcon *iconImage;
@end
// Disable Pull to Full for landscape videos - @bhackel
@interface YTWatchPullToFullController : NSObject
@property(nonatomic, strong) YTWatchViewController *playerViewSource;
@end
@interface YTWatchViewController (uYouEnhanced)
@property(nonatomic, strong) YTWatchPullToFullController *pullToFullController;
- (NSUInteger)allowedFullScreenOrientations;
@end
// uYouPlus
@interface YTHeaderLogoController : UIView
@property(readonly, nonatomic) long long pageStyle;

View file

@ -657,12 +657,29 @@ BOOL isAd(YTIElementRenderer *self) {
}
%end
// Disable pull to enter vertical fullscreen gesture - @bhackel
// Disable pull to enter vertical/portrait fullscreen gesture - @bhackel
// This was introduced in version 19.XX
// This only applies to landscape videos
%group gDisablePullToFull
%hook YTColdConfig
- (BOOL)enablePullToFull { return NO; }
- (BOOL)enablePullToFullAlwaysExitFullscreenLandscape { return NO; }
%hook YTWatchPullToFullController
// New variable to store the controller
- (BOOL)shouldRecognizeOverscrollEventsFromWatchOverscrollController:(id)arg1 {
NSLog(@"bhackel - shouldRecognizeOverscrollEventsFromWatchOverscrollController");
// Get the current player orientation
YTWatchViewController *watchViewController = self.playerViewSource;
NSUInteger allowedFullScreenOrientations = [watchViewController allowedFullScreenOrientations];
NSLog(@"bhackel - current orientation: %lu", allowedFullScreenOrientations);
// Check if the current player orientation is portrait
if (allowedFullScreenOrientations == UIInterfaceOrientationMaskAllButUpsideDown
|| allowedFullScreenOrientations == UIInterfaceOrientationMaskPortrait
|| allowedFullScreenOrientations == UIInterfaceOrientationMaskPortraitUpsideDown) {
NSLog(@"bhackel - allow pull to full: YES");
return %orig;
} else {
NSLog(@"bhackel - allow pull to full: NO");
return NO;
}
}
%end
%end