Merge pull request #543 from bhackel/feat/disable-vert-fullscreen-gesture

Feat/Disable Pull To Full gesture
This commit is contained in:
arichornlover 2024-04-14 02:35:58 -05:00 committed by GitHub
commit 06925a9a4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 5 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,24 @@ 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
- (BOOL)shouldRecognizeOverscrollEventsFromWatchOverscrollController:(id)arg1 {
// Get the current player orientation
YTWatchViewController *watchViewController = self.playerViewSource;
NSUInteger allowedFullScreenOrientations = [watchViewController allowedFullScreenOrientations];
// Check if the current player orientation is portrait
if (allowedFullScreenOrientations == UIInterfaceOrientationMaskAllButUpsideDown
|| allowedFullScreenOrientations == UIInterfaceOrientationMaskPortrait
|| allowedFullScreenOrientations == UIInterfaceOrientationMaskPortraitUpsideDown) {
return %orig;
} else {
return NO;
}
}
%end
%end

View file

@ -244,7 +244,7 @@ extern NSBundle *uYouPlusBundle();
SWITCH_ITEM2(LOC(@"PINCH_TO_ZOOM"), LOC(@"PINCH_TO_ZOOM_DESC"), @"pinchToZoom_enabled");
SWITCH_ITEM(LOC(@"YT_MINIPLAYER"), LOC(@"YT_MINIPLAYER_DESC"), @"ytMiniPlayer_enabled");
SWITCH_ITEM2(LOC(@"STOCK_VOLUME_HUD"), LOC(@"STOCK_VOLUME_HUD_DESC"), @"stockVolumeHUD_enabled");
SWITCH_ITEM2(LOC(@"Disable portrait fullscreen gesture"), LOC(@"Disable the drag gesture to enter vertical fullscreen"), @"disablePullToFull_enabled");
SWITCH_ITEM2(LOC(@"Disable pull-to-fullscreen gesture"), LOC(@"Disable the drag gesture to enter vertical fullscreen. Only applies to landscape videos."), @"disablePullToFull_enabled");
# pragma mark - Video controls overlay options
SECTION_HEADER(LOC(@"VIDEO_PLAYER_OPTIONS"));