diff --git a/Sources/uYouPlus.h b/Sources/uYouPlus.h index d1b2c6e..c30beeb 100644 --- a/Sources/uYouPlus.h +++ b/Sources/uYouPlus.h @@ -30,6 +30,7 @@ #import #import #import +#import // Hide buttons under the video player by @PoomSmart #import @@ -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; diff --git a/Sources/uYouPlus.xm b/Sources/uYouPlus.xm index bb55225..4e70b6b 100644 --- a/Sources/uYouPlus.xm +++ b/Sources/uYouPlus.xm @@ -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 diff --git a/Sources/uYouPlusSettings.xm b/Sources/uYouPlusSettings.xm index aa5a0cb..7c1ee6b 100644 --- a/Sources/uYouPlusSettings.xm +++ b/Sources/uYouPlusSettings.xm @@ -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"));