From a43f8ff13e2571ee7ce361d291cad4c17dad5fa4 Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Wed, 10 Apr 2024 23:06:20 -0700 Subject: [PATCH 1/2] Allow feature for portrait videos --- Sources/uYouPlus.h | 10 ++++++++++ Sources/uYouPlus.xm | 25 +++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) 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..214d67c 100644 --- a/Sources/uYouPlus.xm +++ b/Sources/uYouPlus.xm @@ -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 From 420cff5432b02ff8274d3e913241d5f1397f08c2 Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Sat, 13 Apr 2024 22:59:27 -0700 Subject: [PATCH 2/2] Cleanup --- Sources/uYouPlus.xm | 5 ----- Sources/uYouPlusSettings.xm | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Sources/uYouPlus.xm b/Sources/uYouPlus.xm index 214d67c..4e70b6b 100644 --- a/Sources/uYouPlus.xm +++ b/Sources/uYouPlus.xm @@ -662,21 +662,16 @@ BOOL isAd(YTIElementRenderer *self) { // This only applies to landscape videos %group gDisablePullToFull %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; } } diff --git a/Sources/uYouPlusSettings.xm b/Sources/uYouPlusSettings.xm index 92c113e..8fe122b 100644 --- a/Sources/uYouPlusSettings.xm +++ b/Sources/uYouPlusSettings.xm @@ -229,7 +229,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"));