From df3d09e81d21e67b9d87505155f97071e5fd6201 Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Tue, 6 Aug 2024 22:36:59 -0700 Subject: [PATCH 01/18] Gesture test using YTHFS code --- Source/Settings.xm | 3 ++- YTLitePlus.xm | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/Source/Settings.xm b/Source/Settings.xm index ca3518d..aad8fde 100644 --- a/Source/Settings.xm +++ b/Source/Settings.xm @@ -114,7 +114,7 @@ static const NSInteger YTLiteSection = 789; accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { - return [%c(YTUIUtils) openURL:[NSURL URLWithString:@"https://github.com/Balackburn/YTLitePlus/releases/latest"]]; + return [%c(YTUIUtils) openURL:[NSURL URLWithString:@"https://github.com/YTLitePlus/YTLitePlus/releases/latest"]]; }]; [sectionItems addObject:main]; @@ -231,6 +231,7 @@ static const NSInteger YTLiteSection = 789; BASIC_SWITCH(LOC(@"ALWAYS_USE_REMAINING_TIME"), LOC(@"ALWAYS_USE_REMAINING_TIME_DESC"), @"alwaysShowRemainingTime_enabled"), BASIC_SWITCH(LOC(@"DISABLE_TOGGLE_TIME_REMAINING"), LOC(@"DISABLE_TOGGLE_TIME_REMAINING_DESC"), @"disableRemainingTime_enabled"), BASIC_SWITCH(LOC(@"DISABLE_ENGAGEMENT_OVERLAY"), LOC(@"DISABLE_ENGAGEMENT_OVERLAY_DESC"), @"disableEngagementOverlay_enabled"), + BASIC_SWITCH(LOC(@"ENABLE_UYOU_GESTURES"), LOC(@"ENABLE_UYOU_GESTURES_DESC"), @"uYouGestures_enabled"), ]; YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"VIDEO_CONTROLS_OVERLAY_OPTIONS") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]]; [settingsViewController pushViewController:picker]; diff --git a/YTLitePlus.xm b/YTLitePlus.xm index b9d5a9e..8032c1f 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -542,6 +542,52 @@ BOOL isTabSelected = NO; } %end +@interface YTPlayerViewController (YTLitePlus) +// the long press gesture that will be created and added to the player view +@property (nonatomic, retain) UILongPressGestureRecognizer *YTLitePlusLongPressGesture; +@end + +// Gestures - @bhackel +%group uYouGestures +%hook YTWatchLayerViewController +// invoked when the player view controller is either created or destroyed +- (void)watchController:(YTWatchController *)watchController didSetPlayerViewController:(YTPlayerViewController *)playerViewController { + if (playerViewController) { + // check to see if the long press gesture is already created + if (!playerViewController.YTLitePlusLongPressGesture) { + playerViewController.YTLitePlusLongPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:playerViewController + action:@selector(YTLitePlusHandleLongPressGesture:)]; + playerViewController.YTLitePlusLongPressGesture.numberOfTouchesRequired = 1; + playerViewController.YTLitePlusLongPressGesture.allowableMovement = 50; + playerViewController.YTLitePlusLongPressGesture.minimumPressDuration = 0.5; + [playerViewController.playerView addGestureRecognizer:playerViewController.YTLitePlusLongPressGesture]; + } + } + %orig; +} +%end + +%hook YTPlayerViewController +// the long press gesture that will be created and added to the player view +%property (nonatomic, retain) UILongPressGestureRecognizer *YTLitePlusLongPressGesture; +%new +- (void)YTLitePlusHandleLongPressGesture:(UILongPressGestureRecognizer *)longPressGestureRecognizer +{ + if (longPressGestureRecognizer.state == UIGestureRecognizerStateBegan) { + UINotificationFeedbackGenerator *feedbackGenerator = [[UINotificationFeedbackGenerator alloc] init]; + [feedbackGenerator notificationOccurred:UINotificationFeedbackTypeSuccess]; + feedbackGenerator = nil; + } + // create a popup for debugging + UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Long Press Gesture" message:@"Long Press Gesture Detected" preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; + [alert addAction:okAction]; + [self presentViewController:alert animated:YES completion:nil]; + +} +%end +%end + // BigYTMiniPlayer: https://github.com/Galactic-Dev/BigYTMiniPlayer %group Main %hook YTWatchMiniBarView @@ -756,6 +802,9 @@ BOOL isTabSelected = NO; if (IsEnabled(@"disableEngagementOverlay_enabled")) { %init(gDisableEngagementOverlay); } + if (IsEnabled(@"uYouGestures_enabled")) { + %init(uYouGestures); + } // Change the default value of some options NSArray *allKeys = [[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys]; From d4679b8414cfa6d5949f117d4bff7e441537b64e Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Tue, 6 Aug 2024 23:49:31 -0700 Subject: [PATCH 02/18] Attempt Volume Sliding --- YTLitePlus.h | 4 +++ YTLitePlus.xm | 90 +++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 74 insertions(+), 20 deletions(-) diff --git a/YTLitePlus.h b/YTLitePlus.h index f2de2c4..dcd9435 100644 --- a/YTLitePlus.h +++ b/YTLitePlus.h @@ -6,6 +6,8 @@ #import #import #import +#import +#import #import "Tweaks/FLEX/FLEX.h" #import "Tweaks/YouTubeHeader/YTAppDelegate.h" @@ -39,6 +41,8 @@ #import "Tweaks/YouTubeHeader/YTWatchPullToFullController.h" #import "Tweaks/YouTubeHeader/YTPlayerBarController.h" #import "Tweaks/YouTubeHeader/YTResponder.h" +#import "Tweaks/YouTubeHeader/YTMultiSizeViewController.h" +#import "Tweaks/YouTubeHeader/YTWatchLayerViewController.h" #define LOC(x) [tweakBundle localizedStringForKey:x value:nil table:nil] #define YT_BUNDLE_ID @"com.google.ios.youtube" diff --git a/YTLitePlus.xm b/YTLitePlus.xm index 8032c1f..95393e4 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -544,7 +544,12 @@ BOOL isTabSelected = NO; @interface YTPlayerViewController (YTLitePlus) // the long press gesture that will be created and added to the player view -@property (nonatomic, retain) UILongPressGestureRecognizer *YTLitePlusLongPressGesture; +@property (nonatomic, retain) UIPanGestureRecognizer *YTLitePlusPanGesture; +@end +@interface YTWatchFullscreenViewController : YTMultiSizeViewController +@end +@interface MPVolumeController : NSObject +@property (nonatomic, assign, readwrite) float volumeValue; @end // Gestures - @bhackel @@ -553,14 +558,11 @@ BOOL isTabSelected = NO; // invoked when the player view controller is either created or destroyed - (void)watchController:(YTWatchController *)watchController didSetPlayerViewController:(YTPlayerViewController *)playerViewController { if (playerViewController) { - // check to see if the long press gesture is already created - if (!playerViewController.YTLitePlusLongPressGesture) { - playerViewController.YTLitePlusLongPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:playerViewController - action:@selector(YTLitePlusHandleLongPressGesture:)]; - playerViewController.YTLitePlusLongPressGesture.numberOfTouchesRequired = 1; - playerViewController.YTLitePlusLongPressGesture.allowableMovement = 50; - playerViewController.YTLitePlusLongPressGesture.minimumPressDuration = 0.5; - [playerViewController.playerView addGestureRecognizer:playerViewController.YTLitePlusLongPressGesture]; + // check to see if the pan gesture is already created + if (!playerViewController.YTLitePlusPanGesture) { + playerViewController.YTLitePlusPanGesture = [[UIPanGestureRecognizer alloc] initWithTarget:playerViewController + action:@selector(YTLitePlusHandlePanGesture:)]; + [playerViewController.playerView addGestureRecognizer:playerViewController.YTLitePlusPanGesture]; } } %orig; @@ -568,26 +570,74 @@ BOOL isTabSelected = NO; %end %hook YTPlayerViewController -// the long press gesture that will be created and added to the player view -%property (nonatomic, retain) UILongPressGestureRecognizer *YTLitePlusLongPressGesture; +// the pan gesture that will be created and added to the player view +%property (nonatomic, retain) UIPanGestureRecognizer *YTLitePlusPanGesture; %new -- (void)YTLitePlusHandleLongPressGesture:(UILongPressGestureRecognizer *)longPressGestureRecognizer -{ - if (longPressGestureRecognizer.state == UIGestureRecognizerStateBegan) { +- (void)YTLitePlusHandlePanGesture:(UIPanGestureRecognizer *)panGestureRecognizer { + static float initialVolume; + + if (panGestureRecognizer.state == UIGestureRecognizerStateBegan) { + // Store the initial volume at the beginning of the pan gesture + initialVolume = [[AVAudioSession sharedInstance] outputVolume]; + } + + if (panGestureRecognizer.state == UIGestureRecognizerStateChanged) { + // Calculate the horizontal translation + CGPoint translation = [panGestureRecognizer translationInView:self.view]; + float newVolume = initialVolume + (translation.x / 1000.0); // Adjust the divisor to control the sensitivity + + // Clamp the volume between 0 and 1 + newVolume = fmaxf(fminf(newVolume, 1.0), 0.0); + + /* + // Navigate to existing volume slider view + YTWatchViewController *watchViewController = (YTWatchViewController *)[self valueForKey:@"_parentViewController"]; + YTWatchLayerViewController *watchLayerViewController = (YTWatchLayerViewController *)[watchViewController valueForKey:@"_watchLayerViewController"]; + YTWatchFullscreenViewController *watchFullscreenViewController = (YTWatchFullscreenViewController *)[watchLayerViewController valueForKey:@"_fullscreenViewController"]; + MPVolumeView *volumeView = (MPVolumeView *)[watchFullscreenViewController valueForKey:@"_hiddenVolumeView"]; + + // https://stackoverflow.com/questions/50737943/how-to-change-volume-programmatically-on-ios-11-4/50740074#50740074 + UISlider *volumeViewSlider = nil; + for (UIView *view in volumeView.subviews) { + if ([view isKindOfClass:[UISlider class]]) { + volumeViewSlider = (UISlider *)view; + break; + } + } + // Get the controller from this view + MPVolumeController *volumeController = [volumeViewSlider valueForKey:@"volumeController"]; + // Set the volume + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + volumeController.volumeValue = newVolume; + }); + */ + + MPVolumeView *volumeView = [[MPVolumeView alloc] init]; + UISlider *volumeViewSlider = nil; + + for (UIView *view in volumeView.subviews) { + if ([view isKindOfClass:[UISlider class]]) { + volumeViewSlider = (UISlider *)view; + break; + } + } + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + volumeViewSlider.value = newVolume; + }); + } + + if (panGestureRecognizer.state == UIGestureRecognizerStateEnded) { + // Haptic feedback UINotificationFeedbackGenerator *feedbackGenerator = [[UINotificationFeedbackGenerator alloc] init]; [feedbackGenerator notificationOccurred:UINotificationFeedbackTypeSuccess]; feedbackGenerator = nil; } - // create a popup for debugging - UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Long Press Gesture" message:@"Long Press Gesture Detected" preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; - [alert addAction:okAction]; - [self presentViewController:alert animated:YES completion:nil]; - } %end %end + // BigYTMiniPlayer: https://github.com/Galactic-Dev/BigYTMiniPlayer %group Main %hook YTWatchMiniBarView From 91290efdfe7394aa78871aa10f2aec160d6cbf79 Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Wed, 7 Aug 2024 13:24:51 -0700 Subject: [PATCH 03/18] Allow other gestures --- YTLitePlus.xm | 89 ++++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/YTLitePlus.xm b/YTLitePlus.xm index 95393e4..5c9c210 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -542,9 +542,10 @@ BOOL isTabSelected = NO; } %end -@interface YTPlayerViewController (YTLitePlus) +@interface YTPlayerViewController (YTLitePlus) // the long press gesture that will be created and added to the player view @property (nonatomic, retain) UIPanGestureRecognizer *YTLitePlusPanGesture; +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer; @end @interface YTWatchFullscreenViewController : YTMultiSizeViewController @end @@ -562,78 +563,80 @@ BOOL isTabSelected = NO; if (!playerViewController.YTLitePlusPanGesture) { playerViewController.YTLitePlusPanGesture = [[UIPanGestureRecognizer alloc] initWithTarget:playerViewController action:@selector(YTLitePlusHandlePanGesture:)]; + playerViewController.YTLitePlusPanGesture.delegate = playerViewController; [playerViewController.playerView addGestureRecognizer:playerViewController.YTLitePlusPanGesture]; } } %orig; } %end - %hook YTPlayerViewController // the pan gesture that will be created and added to the player view %property (nonatomic, retain) UIPanGestureRecognizer *YTLitePlusPanGesture; %new - (void)YTLitePlusHandlePanGesture:(UIPanGestureRecognizer *)panGestureRecognizer { static float initialVolume; + static BOOL isHorizontalPan = NO; if (panGestureRecognizer.state == UIGestureRecognizerStateBegan) { // Store the initial volume at the beginning of the pan gesture initialVolume = [[AVAudioSession sharedInstance] outputVolume]; + // Reset the horizontal pan flag + isHorizontalPan = NO; } if (panGestureRecognizer.state == UIGestureRecognizerStateChanged) { - // Calculate the horizontal translation + // Calculate the translation CGPoint translation = [panGestureRecognizer translationInView:self.view]; - float newVolume = initialVolume + (translation.x / 1000.0); // Adjust the divisor to control the sensitivity - // Clamp the volume between 0 and 1 - newVolume = fmaxf(fminf(newVolume, 1.0), 0.0); - - /* - // Navigate to existing volume slider view - YTWatchViewController *watchViewController = (YTWatchViewController *)[self valueForKey:@"_parentViewController"]; - YTWatchLayerViewController *watchLayerViewController = (YTWatchLayerViewController *)[watchViewController valueForKey:@"_watchLayerViewController"]; - YTWatchFullscreenViewController *watchFullscreenViewController = (YTWatchFullscreenViewController *)[watchLayerViewController valueForKey:@"_fullscreenViewController"]; - MPVolumeView *volumeView = (MPVolumeView *)[watchFullscreenViewController valueForKey:@"_hiddenVolumeView"]; - - // https://stackoverflow.com/questions/50737943/how-to-change-volume-programmatically-on-ios-11-4/50740074#50740074 - UISlider *volumeViewSlider = nil; - for (UIView *view in volumeView.subviews) { - if ([view isKindOfClass:[UISlider class]]) { - volumeViewSlider = (UISlider *)view; - break; + // Determine if the gesture is predominantly horizontal + if (!isHorizontalPan) { + if (fabs(translation.x) > fabs(translation.y)) { + isHorizontalPan = YES; + } else { + // If vertical movement is greater, cancel the gesture recognizer + panGestureRecognizer.state = UIGestureRecognizerStateCancelled; + return; } } - // Get the controller from this view - MPVolumeController *volumeController = [volumeViewSlider valueForKey:@"volumeController"]; - // Set the volume - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - volumeController.volumeValue = newVolume; - }); - */ - - MPVolumeView *volumeView = [[MPVolumeView alloc] init]; - UISlider *volumeViewSlider = nil; - - for (UIView *view in volumeView.subviews) { - if ([view isKindOfClass:[UISlider class]]) { - volumeViewSlider = (UISlider *)view; - break; + + if (isHorizontalPan) { + float newVolume = initialVolume + (translation.x / 1000.0); // Adjust the divisor to control the sensitivity + + // Clamp the volume between 0 and 1 + newVolume = fmaxf(fminf(newVolume, 1.0), 0.0); + + // https://stackoverflow.com/questions/50737943/how-to-change-volume-programmatically-on-ios-11-4/50740074#50740074 + MPVolumeView *volumeView = [[MPVolumeView alloc] init]; + UISlider *volumeViewSlider = nil; + for (UIView *view in volumeView.subviews) { + if ([view isKindOfClass:[UISlider class]]) { + volumeViewSlider = (UISlider *)view; + break; + } } + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + volumeViewSlider.value = newVolume; + }); } - - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - volumeViewSlider.value = newVolume; - }); } if (panGestureRecognizer.state == UIGestureRecognizerStateEnded) { - // Haptic feedback - UINotificationFeedbackGenerator *feedbackGenerator = [[UINotificationFeedbackGenerator alloc] init]; - [feedbackGenerator notificationOccurred:UINotificationFeedbackTypeSuccess]; - feedbackGenerator = nil; + if (isHorizontalPan) { + // Haptic feedback + UINotificationFeedbackGenerator *feedbackGenerator = [[UINotificationFeedbackGenerator alloc] init]; + [feedbackGenerator notificationOccurred:UINotificationFeedbackTypeSuccess]; + feedbackGenerator = nil; + } } } + +// allow the pan gesture to be recognized simultaneously with other gestures +%new +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { + return YES; +} + %end %end From 64c712d630c7125b3ae41daec7c1b86a3778cc4c Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Fri, 9 Aug 2024 16:51:12 -0700 Subject: [PATCH 04/18] Attempt brightness and volume gestures --- YTLitePlus.xm | 65 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 19 deletions(-) diff --git a/YTLitePlus.xm b/YTLitePlus.xm index 5c9c210..4c49cee 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -576,17 +576,32 @@ BOOL isTabSelected = NO; %new - (void)YTLitePlusHandlePanGesture:(UIPanGestureRecognizer *)panGestureRecognizer { static float initialVolume; + static float initialBrightness; static BOOL isHorizontalPan = NO; + static NSInteger gestureSection = 0; // 1 for brightness, 2 for volume, 3 for seeking if (panGestureRecognizer.state == UIGestureRecognizerStateBegan) { - // Store the initial volume at the beginning of the pan gesture - initialVolume = [[AVAudioSession sharedInstance] outputVolume]; + // Get the gesture's start position + CGPoint startLocation = [panGestureRecognizer locationInView:self.view]; + CGFloat viewHeight = self.view.bounds.size.height; + + // Determine the section based on the start position + if (startLocation.y <= viewHeight / 3.0) { + gestureSection = 1; // Top third: Brightness + initialBrightness = [UIScreen mainScreen].brightness; + } else if (startLocation.y <= 2 * viewHeight / 3.0) { + gestureSection = 2; // Middle third: Volume + initialVolume = [[AVAudioSession sharedInstance] outputVolume]; + } else { + gestureSection = 3; // Bottom third: Seeking + } + // Reset the horizontal pan flag isHorizontalPan = NO; } if (panGestureRecognizer.state == UIGestureRecognizerStateChanged) { - // Calculate the translation + // Calculate the translation of the gesture CGPoint translation = [panGestureRecognizer translationInView:self.view]; // Determine if the gesture is predominantly horizontal @@ -600,30 +615,42 @@ BOOL isTabSelected = NO; } } + // Handle the gesture based on the identified section if (isHorizontalPan) { - float newVolume = initialVolume + (translation.x / 1000.0); // Adjust the divisor to control the sensitivity - - // Clamp the volume between 0 and 1 - newVolume = fmaxf(fminf(newVolume, 1.0), 0.0); - - // https://stackoverflow.com/questions/50737943/how-to-change-volume-programmatically-on-ios-11-4/50740074#50740074 - MPVolumeView *volumeView = [[MPVolumeView alloc] init]; - UISlider *volumeViewSlider = nil; - for (UIView *view in volumeView.subviews) { - if ([view isKindOfClass:[UISlider class]]) { - volumeViewSlider = (UISlider *)view; - break; + if (gestureSection == 1) { + // Top third: Adjust brightness + float newBrightness = initialBrightness + (translation.x / 1000.0); + newBrightness = fmaxf(fminf(newBrightness, 1.0), 0.0); + [[UIScreen mainScreen] setBrightness:newBrightness]; + + } else if (gestureSection == 2) { + // Middle third: Adjust volume + float newVolume = initialVolume + (translation.x / 1000.0); + newVolume = fmaxf(fminf(newVolume, 1.0), 0.0); + + MPVolumeView *volumeView = [[MPVolumeView alloc] init]; + UISlider *volumeViewSlider = nil; + for (UIView *view in volumeView.subviews) { + if ([view isKindOfClass:[UISlider class]]) { + volumeViewSlider = (UISlider *)view; + break; + } } + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + volumeViewSlider.value = newVolume; + }); + + } else if (gestureSection == 3) { + // Bottom third: Seek functionality (implement your seeking logic here) + // Example: Adjust playback position based on horizontal swipe + // (Add your media player's seeking logic here) } - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - volumeViewSlider.value = newVolume; - }); } } if (panGestureRecognizer.state == UIGestureRecognizerStateEnded) { if (isHorizontalPan) { - // Haptic feedback + // Provide haptic feedback upon successful gesture recognition UINotificationFeedbackGenerator *feedbackGenerator = [[UINotificationFeedbackGenerator alloc] init]; [feedbackGenerator notificationOccurred:UINotificationFeedbackTypeSuccess]; feedbackGenerator = nil; From 9aa33a676d2c04f6de1c107be2e7f6af1b54bb25 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 14 Aug 2024 00:53:53 +0000 Subject: [PATCH 05/18] updated submodules --- Tweaks/protobuf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tweaks/protobuf b/Tweaks/protobuf index b71e5ee..b9f46b8 160000 --- a/Tweaks/protobuf +++ b/Tweaks/protobuf @@ -1 +1 @@ -Subproject commit b71e5ee2d5d91b101fbb49038af66d0fd0d7be6a +Subproject commit b9f46b822ec0d29bf22f80abde5c1e0036ec59fc From b588b7f6d0af074f2850187f4bb7c51ee71db010 Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Tue, 13 Aug 2024 22:02:23 -0700 Subject: [PATCH 06/18] Attempt seek gesture --- YTLitePlus.xm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/YTLitePlus.xm b/YTLitePlus.xm index 4c49cee..dcd30b4 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -579,6 +579,7 @@ BOOL isTabSelected = NO; static float initialBrightness; static BOOL isHorizontalPan = NO; static NSInteger gestureSection = 0; // 1 for brightness, 2 for volume, 3 for seeking + static CGFloat currentTime; if (panGestureRecognizer.state == UIGestureRecognizerStateBegan) { // Get the gesture's start position @@ -594,6 +595,7 @@ BOOL isTabSelected = NO; initialVolume = [[AVAudioSession sharedInstance] outputVolume]; } else { gestureSection = 3; // Bottom third: Seeking + currentTime = self.currentVideoMediaTime; } // Reset the horizontal pan flag @@ -641,9 +643,16 @@ BOOL isTabSelected = NO; }); } else if (gestureSection == 3) { - // Bottom third: Seek functionality (implement your seeking logic here) - // Example: Adjust playback position based on horizontal swipe - // (Add your media player's seeking logic here) + // Bottom third: Seek functionality + // Calculate a seek fraction based on the horizontal translation + CGFloat totalDuration = self.currentVideoTotalMediaTime; + CGFloat viewWidth = self.view.bounds.size.width; + CGFloat seekFraction = (translation.x / viewWidth); + // Seek to the new time based on the calculated offset + CGFloat sensitivityFactor = 1; // Adjust this value to make seeking less sensitive + seekFraction = sensitivityFactor * seekFraction; + CGFloat seekTime = currentTime + totalDuration * seekFraction; + [self seekToTime:seekTime]; } } } From e92ada842799d3049994c8d57ea90ddb1dc8d3b8 Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Wed, 14 Aug 2024 22:20:36 -0700 Subject: [PATCH 07/18] Gesture settings --- Source/Settings.xm | 69 +++++++++++++++++++++++++++++++++++++++++++++- YTLitePlus.h | 8 ++++++ YTLitePlus.xm | 6 ++-- 3 files changed, 79 insertions(+), 4 deletions(-) diff --git a/Source/Settings.xm b/Source/Settings.xm index 8a59e05..f91c786 100644 --- a/Source/Settings.xm +++ b/Source/Settings.xm @@ -212,6 +212,73 @@ static const NSInteger YTLiteSection = 789; [sectionItems addObject:appIcon]; */ +# pragma mark - Player Gestures - @bhackel + // Helper to get the selected gesture mode + static NSString* (^sectionGestureSelectedMode)(GestureMode) = ^(GestureMode sectionIndex) { + switch (sectionIndex) { + case GestureModeVolume: + return LOC(@"Volume (Beta)"); + case GestureModeBrightness: + return LOC(@"Brightness (Beta)"); + case GestureModeSeek: + return LOC(@"Seek (Beta)"); + default: + return @"Invalid index - Report bug"; + } + }; + + + // Helper to generate checkmark setting items for selecting gesture modes + static YTSettingsSectionItem* (^gestureCheckmarkSettingItem)(NSInteger, NSString *) = ^(NSInteger idx, NSString *key) { + return [YTSettingsSectionItemClass + checkmarkItemWithTitle:sectionGestureSelectedMode(idx) + selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { + [[NSUserDefaults standardUserDefaults] setInteger:idx forKey:key]; + [settingsViewController reloadData]; + return YES; + } + ]; + }; + + // Helper to generate a section item for selecting a gesture mode + YTSettingsSectionItem *(^createSectionGestureSelector)(NSString *, NSString *) = ^YTSettingsSectionItem *(NSString *sectionLabel, NSString *sectionKey) { + return [YTSettingsSectionItemClass itemWithTitle:LOC(sectionLabel) + accessibilityIdentifier:nil + detailTextBlock:^NSString *() { + return sectionGestureSelectedMode(GetSelection(sectionKey)); + } + selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { + NSArray *rows = @[ + gestureCheckmarkSettingItem(0, sectionKey), + gestureCheckmarkSettingItem(1, sectionKey), + gestureCheckmarkSettingItem(2, sectionKey) + ]; + + YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] + initWithNavTitle:LOC(sectionLabel) + pickerSectionTitle:nil + rows:rows + selectedItemIndex:GetSelection(sectionKey) + parentResponder:[self parentResponder] + ]; + [settingsViewController pushViewController:picker]; + return YES; + } + ]; + }; + // High level gestures menu + YTSettingsSectionItem *playerGesturesGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"Player Gestures (Beta)") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { + NSArray *rows = @[ + createSectionGestureSelector(@"Top Section (Beta)", @"playerGestureTopSelection"), + createSectionGestureSelector(@"Middle Section (Beta)", @"playerGestureMiddleSelection"), + createSectionGestureSelector(@"Bottom Section (Beta)", @"playerGestureBottomSelection") + ]; + YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"Player Gestures (Beta)") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]]; + [settingsViewController pushViewController:picker]; + return YES; + }]; + [sectionItems addObject:playerGesturesGroup]; + # pragma mark - Video Controls Overlay Options YTSettingsSectionItem *videoControlOverlayGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"VIDEO_CONTROLS_OVERLAY_OPTIONS") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { NSArray *rows = @[ @@ -234,7 +301,7 @@ static const NSInteger YTLiteSection = 789; BASIC_SWITCH(LOC(@"HIDE_HUD_MESSAGES"), LOC(@"HIDE_HUD_MESSAGES_DESC"), @"hideHUD_enabled"), BASIC_SWITCH(LOC(@"HIDE_COLLAPSE_BUTTON"), LOC(@"HIDE_COLLAPSE_BUTTON_DESC"), @"disableCollapseButton_enabled"), BASIC_SWITCH(LOC(@"HIDE_SPEED_TOAST"), LOC(@"HIDE_SPEED_TOAST_DESC"), @"hideSpeedToast_enabled"), - BASIC_SWITCH(LOC(@"ENABLE_UYOU_GESTURES"), LOC(@"ENABLE_UYOU_GESTURES_DESC"), @"uYouGestures_enabled"), + BASIC_SWITCH(LOC(@"ENABLE_UYOU_GESTURES"), LOC(@"ENABLE_UYOU_GESTURES_DESC"), @"playerGestures_enabled"), ]; YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"VIDEO_CONTROLS_OVERLAY_OPTIONS") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]]; [settingsViewController pushViewController:picker]; diff --git a/YTLitePlus.h b/YTLitePlus.h index 16f63f9..63ae3af 100644 --- a/YTLitePlus.h +++ b/YTLitePlus.h @@ -52,6 +52,14 @@ #define IS_ENABLED(k) [[NSUserDefaults standardUserDefaults] boolForKey:k] #define APP_THEME_IDX [[NSUserDefaults standardUserDefaults] integerForKey:@"appTheme"] +// Enum for Player Gesture selected modes +typedef NS_ENUM(NSUInteger, GestureMode) { + GestureModeVolume, + GestureModeBrightness, + GestureModeSeek, + GestureModeInvalid +}; + // YTSpeed @interface YTVarispeedSwitchControllerOption : NSObject - (id)initWithTitle:(id)title rate:(float)rate; diff --git a/YTLitePlus.xm b/YTLitePlus.xm index 32a058c..712c7c3 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -657,7 +657,7 @@ BOOL isTabSelected = NO; @end // Gestures - @bhackel -%group uYouGestures +%group playerGestures %hook YTWatchLayerViewController // invoked when the player view controller is either created or destroyed - (void)watchController:(YTWatchController *)watchController didSetPlayerViewController:(YTPlayerViewController *)playerViewController { @@ -1008,8 +1008,8 @@ BOOL isTabSelected = NO; if (IsEnabled(@"disableEngagementOverlay_enabled")) { %init(gDisableEngagementOverlay); } - if (IsEnabled(@"uYouGestures_enabled")) { - %init(uYouGestures); + if (IsEnabled(@"playerGestures_enabled")) { + %init(playerGestures); } // Change the default value of some options From 8ed3d97d2debf5b69c1a5d9da494086a668fd5f4 Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Wed, 14 Aug 2024 23:56:27 -0700 Subject: [PATCH 08/18] Gesture refactor for settings --- YTLitePlus.xm | 119 ++++++++++++++++++++++++++++---------------------- 1 file changed, 67 insertions(+), 52 deletions(-) diff --git a/YTLitePlus.xm b/YTLitePlus.xm index 712c7c3..42db9bf 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -673,6 +673,14 @@ BOOL isTabSelected = NO; %orig; } %end +// Gesture Section Enum +typedef NS_ENUM(NSInteger, GestureSection) { + GestureSectionTop, + GestureSectionMiddle, + GestureSectionBottom, + GestureSectionInvalid +}; + %hook YTPlayerViewController // the pan gesture that will be created and added to the player view %property (nonatomic, retain) UIPanGestureRecognizer *YTLitePlusPanGesture; @@ -680,39 +688,74 @@ BOOL isTabSelected = NO; - (void)YTLitePlusHandlePanGesture:(UIPanGestureRecognizer *)panGestureRecognizer { static float initialVolume; static float initialBrightness; - static BOOL isHorizontalPan = NO; - static NSInteger gestureSection = 0; // 1 for brightness, 2 for volume, 3 for seeking + static BOOL isValidHorizontalPan = NO; + static GestureSection gestureSection = GestureSectionInvalid; static CGFloat currentTime; + // Helper function to adjust brightness + void (^adjustBrightness)(CGFloat, CGFloat) = ^(CGFloat translationX, CGFloat initialBrightness) { + float newBrightness = initialBrightness + (translationX / 1000.0); + newBrightness = fmaxf(fminf(newBrightness, 1.0), 0.0); + [[UIScreen mainScreen] setBrightness:newBrightness]; + }; + // Helper function to adjust volume + void (^adjustVolume)(CGFloat, CGFloat) = ^(CGFloat translationX, CGFloat initialVolume) { + float newVolume = initialVolume + (translationX / 1000.0); + newVolume = fmaxf(fminf(newVolume, 1.0), 0.0); + // https://stackoverflow.com/questions/50737943/how-to-change-volume-programmatically-on-ios-11-4 + MPVolumeView *volumeView = [[MPVolumeView alloc] init]; + UISlider *volumeViewSlider = nil; + for (UIView *view in volumeView.subviews) { + if ([view isKindOfClass:[UISlider class]]) { + volumeViewSlider = (UISlider *)view; + break; + } + } + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + volumeViewSlider.value = newVolume; + }); + }; + // Helper function to adjust seek time + void (^adjustSeek)(CGFloat) = ^(CGFloat translationX) { + // Calculate a seek fraction based on the horizontal translation + CGFloat totalDuration = self.currentVideoTotalMediaTime; + CGFloat viewWidth = self.view.bounds.size.width; + CGFloat seekFraction = (translationX / viewWidth); + // Seek to the new time based on the calculated offset + CGFloat sensitivityFactor = 1; // Adjust this value to make seeking less sensitive + seekFraction = sensitivityFactor * seekFraction; + CGFloat seekTime = currentTime + totalDuration * seekFraction; + [self seekToTime:seekTime]; + }; + // Handle gesture based on current gesture state if (panGestureRecognizer.state == UIGestureRecognizerStateBegan) { // Get the gesture's start position CGPoint startLocation = [panGestureRecognizer locationInView:self.view]; CGFloat viewHeight = self.view.bounds.size.height; // Determine the section based on the start position + // by dividing the view into thirds if (startLocation.y <= viewHeight / 3.0) { - gestureSection = 1; // Top third: Brightness - initialBrightness = [UIScreen mainScreen].brightness; + gestureSection = GestureSectionTop; } else if (startLocation.y <= 2 * viewHeight / 3.0) { - gestureSection = 2; // Middle third: Volume - initialVolume = [[AVAudioSession sharedInstance] outputVolume]; - } else { - gestureSection = 3; // Bottom third: Seeking - currentTime = self.currentVideoMediaTime; + gestureSection = GestureSectionMiddle; + } else if (startLocation.y <= viewHeight) { + gestureSection = GestureSectionBottom; } - // Reset the horizontal pan flag - isHorizontalPan = NO; + // Reset all starting values + isValidHorizontalPan = NO; + initialBrightness = [UIScreen mainScreen].brightness; + initialVolume = [[AVAudioSession sharedInstance] outputVolume]; + currentTime = self.currentVideoMediaTime; } if (panGestureRecognizer.state == UIGestureRecognizerStateChanged) { - // Calculate the translation of the gesture - CGPoint translation = [panGestureRecognizer translationInView:self.view]; - // Determine if the gesture is predominantly horizontal - if (!isHorizontalPan) { + CGPoint translation = [panGestureRecognizer translationInView:self.view]; + if (!isValidHorizontalPan) { if (fabs(translation.x) > fabs(translation.y)) { - isHorizontalPan = YES; + isValidHorizontalPan = YES; } else { // If vertical movement is greater, cancel the gesture recognizer panGestureRecognizer.state = UIGestureRecognizerStateCancelled; @@ -721,47 +764,19 @@ BOOL isTabSelected = NO; } // Handle the gesture based on the identified section - if (isHorizontalPan) { - if (gestureSection == 1) { - // Top third: Adjust brightness - float newBrightness = initialBrightness + (translation.x / 1000.0); - newBrightness = fmaxf(fminf(newBrightness, 1.0), 0.0); - [[UIScreen mainScreen] setBrightness:newBrightness]; - - } else if (gestureSection == 2) { - // Middle third: Adjust volume - float newVolume = initialVolume + (translation.x / 1000.0); - newVolume = fmaxf(fminf(newVolume, 1.0), 0.0); - - MPVolumeView *volumeView = [[MPVolumeView alloc] init]; - UISlider *volumeViewSlider = nil; - for (UIView *view in volumeView.subviews) { - if ([view isKindOfClass:[UISlider class]]) { - volumeViewSlider = (UISlider *)view; - break; - } - } - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - volumeViewSlider.value = newVolume; - }); - - } else if (gestureSection == 3) { - // Bottom third: Seek functionality - // Calculate a seek fraction based on the horizontal translation - CGFloat totalDuration = self.currentVideoTotalMediaTime; - CGFloat viewWidth = self.view.bounds.size.width; - CGFloat seekFraction = (translation.x / viewWidth); - // Seek to the new time based on the calculated offset - CGFloat sensitivityFactor = 1; // Adjust this value to make seeking less sensitive - seekFraction = sensitivityFactor * seekFraction; - CGFloat seekTime = currentTime + totalDuration * seekFraction; - [self seekToTime:seekTime]; + if (isValidHorizontalPan) { + if (gestureSection == GestureSectionTop) { + adjustBrightness(translation.x, initialBrightness); + } else if (gestureSection == GestureSectionMiddle) { + adjustVolume(translation.x, initialVolume); + } else if (gestureSection == GestureSectionBottom) { + adjustSeek(translation.x); } } } if (panGestureRecognizer.state == UIGestureRecognizerStateEnded) { - if (isHorizontalPan) { + if (isValidHorizontalPan) { // Provide haptic feedback upon successful gesture recognition UINotificationFeedbackGenerator *feedbackGenerator = [[UINotificationFeedbackGenerator alloc] init]; [feedbackGenerator notificationOccurred:UINotificationFeedbackTypeSuccess]; From 6854f91c1e640613a2158aa5c26962ea41112a4a Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Thu, 15 Aug 2024 10:45:27 -0700 Subject: [PATCH 09/18] Implement gesture selection --- Source/LowContrastMode.xm | 5 +--- Source/Settings.xm | 14 +++------ Source/Themes.xm | 3 -- Source/VersionSpooferLite.xm | 5 +--- YTLitePlus.h | 17 ++++++++++- YTLitePlus.xm | 57 ++++++++++++++++++++++++++---------- 6 files changed, 63 insertions(+), 38 deletions(-) diff --git a/Source/LowContrastMode.xm b/Source/LowContrastMode.xm index 0b0744e..6948402 100644 --- a/Source/LowContrastMode.xm +++ b/Source/LowContrastMode.xm @@ -1,9 +1,6 @@ #import "../YTLitePlus.h" -// -static BOOL IsEnabled(NSString *key) { - return [[NSUserDefaults standardUserDefaults] boolForKey:key]; -} +// Low Contrast Mode static int contrastMode() { return [[NSUserDefaults standardUserDefaults] integerForKey:@"lcm"]; } diff --git a/Source/Settings.xm b/Source/Settings.xm index f91c786..b1b1fb8 100644 --- a/Source/Settings.xm +++ b/Source/Settings.xm @@ -32,12 +32,6 @@ settingItemId:0] */ -static BOOL IsEnabled(NSString *key) { - return [[NSUserDefaults standardUserDefaults] boolForKey:key]; -} -static int GetSelection(NSString *key) { - return [[NSUserDefaults standardUserDefaults] integerForKey:key]; -} static int contrastMode() { return [[NSUserDefaults standardUserDefaults] integerForKey:@"lcm"]; } @@ -214,7 +208,7 @@ static const NSInteger YTLiteSection = 789; # pragma mark - Player Gestures - @bhackel // Helper to get the selected gesture mode - static NSString* (^sectionGestureSelectedMode)(GestureMode) = ^(GestureMode sectionIndex) { + static NSString* (^sectionGestureSelectedModeToString)(GestureMode) = ^(GestureMode sectionIndex) { switch (sectionIndex) { case GestureModeVolume: return LOC(@"Volume (Beta)"); @@ -231,7 +225,7 @@ static const NSInteger YTLiteSection = 789; // Helper to generate checkmark setting items for selecting gesture modes static YTSettingsSectionItem* (^gestureCheckmarkSettingItem)(NSInteger, NSString *) = ^(NSInteger idx, NSString *key) { return [YTSettingsSectionItemClass - checkmarkItemWithTitle:sectionGestureSelectedMode(idx) + checkmarkItemWithTitle:sectionGestureSelectedModeToString(idx) selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { [[NSUserDefaults standardUserDefaults] setInteger:idx forKey:key]; [settingsViewController reloadData]; @@ -245,7 +239,7 @@ static const NSInteger YTLiteSection = 789; return [YTSettingsSectionItemClass itemWithTitle:LOC(sectionLabel) accessibilityIdentifier:nil detailTextBlock:^NSString *() { - return sectionGestureSelectedMode(GetSelection(sectionKey)); + return sectionGestureSelectedModeToString(GetSelection(sectionKey)); } selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { NSArray *rows = @[ @@ -269,7 +263,7 @@ static const NSInteger YTLiteSection = 789; // High level gestures menu YTSettingsSectionItem *playerGesturesGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"Player Gestures (Beta)") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { NSArray *rows = @[ - createSectionGestureSelector(@"Top Section (Beta)", @"playerGestureTopSelection"), + createSectionGestureSelector(@"Top Section (Beta)", @"playerGestureTopSelection"), createSectionGestureSelector(@"Middle Section (Beta)", @"playerGestureMiddleSelection"), createSectionGestureSelector(@"Bottom Section (Beta)", @"playerGestureBottomSelection") ]; diff --git a/Source/Themes.xm b/Source/Themes.xm index 4ea44b7..50457ff 100644 --- a/Source/Themes.xm +++ b/Source/Themes.xm @@ -1,8 +1,5 @@ #import "../YTLitePlus.h" -static BOOL IsEnabled(NSString *key) { - return [[NSUserDefaults standardUserDefaults] boolForKey:key]; -} static BOOL isDarkMode() { return ([[NSUserDefaults standardUserDefaults] integerForKey:@"page_style"] == 1); } diff --git a/Source/VersionSpooferLite.xm b/Source/VersionSpooferLite.xm index 7399aec..78f2889 100644 --- a/Source/VersionSpooferLite.xm +++ b/Source/VersionSpooferLite.xm @@ -1,9 +1,6 @@ #import "../YTLitePlus.h" -// -static BOOL IsEnabled(NSString *key) { - return [[NSUserDefaults standardUserDefaults] boolForKey:key]; -} + static int appVersionSpoofer() { return [[NSUserDefaults standardUserDefaults] integerForKey:@"versionSpoofer"]; } diff --git a/YTLitePlus.h b/YTLitePlus.h index 63ae3af..9261cfe 100644 --- a/YTLitePlus.h +++ b/YTLitePlus.h @@ -52,13 +52,28 @@ #define IS_ENABLED(k) [[NSUserDefaults standardUserDefaults] boolForKey:k] #define APP_THEME_IDX [[NSUserDefaults standardUserDefaults] integerForKey:@"appTheme"] -// Enum for Player Gesture selected modes +// Avoid issues with multiple includes of this file +#pragma once + +// Helper methods for key retrieval +#define IsEnabled(key) [[NSUserDefaults standardUserDefaults] boolForKey:key] +#define GetSelection(key) [[NSUserDefaults standardUserDefaults] integerForKey:key] + + +// Player Gesture selected mode enum typedef NS_ENUM(NSUInteger, GestureMode) { GestureModeVolume, GestureModeBrightness, GestureModeSeek, GestureModeInvalid }; +// Gesture Section Enum +typedef NS_ENUM(NSUInteger, GestureSection) { + GestureSectionTop, + GestureSectionMiddle, + GestureSectionBottom, + GestureSectionInvalid +}; // YTSpeed @interface YTVarispeedSwitchControllerOption : NSObject diff --git a/YTLitePlus.xm b/YTLitePlus.xm index 42db9bf..41710c9 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -33,11 +33,6 @@ static NSString *accessGroupID() { return accessGroup; } -// -static BOOL IsEnabled(NSString *key) { - return [[NSUserDefaults standardUserDefaults] boolForKey:key]; -} - # pragma mark - Tweaks // Activate FLEX @@ -673,13 +668,7 @@ BOOL isTabSelected = NO; %orig; } %end -// Gesture Section Enum -typedef NS_ENUM(NSInteger, GestureSection) { - GestureSectionTop, - GestureSectionMiddle, - GestureSectionBottom, - GestureSectionInvalid -}; + %hook YTPlayerViewController // the pan gesture that will be created and added to the player view @@ -715,7 +704,7 @@ typedef NS_ENUM(NSInteger, GestureSection) { }); }; // Helper function to adjust seek time - void (^adjustSeek)(CGFloat) = ^(CGFloat translationX) { + void (^adjustSeek)(CGFloat, CGFloat) = ^(CGFloat translationX, CGFloat currentTime) { // Calculate a seek fraction based on the horizontal translation CGFloat totalDuration = self.currentVideoTotalMediaTime; CGFloat viewWidth = self.view.bounds.size.width; @@ -726,6 +715,32 @@ typedef NS_ENUM(NSInteger, GestureSection) { CGFloat seekTime = currentTime + totalDuration * seekFraction; [self seekToTime:seekTime]; }; + // Helper function to run the selected gesture action + void (^runSelectedGesture)(NSString*, CGFloat, CGFloat, CGFloat, CGFloat) = + ^(NSString *sectionKey, CGFloat translationX, CGFloat initialBrightness, CGFloat initialVolume, CGFloat currentTime) { + + // Determine the selected gesture mode using the section key + GestureMode selectedGestureMode = (GestureMode)GetSelection(sectionKey); + // Handle the gesture action based on the selected mode + switch (selectedGestureMode) { + case GestureModeVolume: + adjustVolume(translationX, initialVolume); + break; + case GestureModeBrightness: + adjustBrightness(translationX, initialBrightness); + break; + case GestureModeSeek: + adjustSeek(translationX, currentTime); + break; + default: + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Invalid Gesture Mode" message:@"Please report this bug." preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; + [alertController addAction:okAction]; + [self presentViewController:alertController animated:YES completion:nil]; + break; + } + }; + // Handle gesture based on current gesture state if (panGestureRecognizer.state == UIGestureRecognizerStateBegan) { @@ -766,11 +781,11 @@ typedef NS_ENUM(NSInteger, GestureSection) { // Handle the gesture based on the identified section if (isValidHorizontalPan) { if (gestureSection == GestureSectionTop) { - adjustBrightness(translation.x, initialBrightness); + runSelectedGesture(@"playerGestureTopSelection", translation.x, initialBrightness, initialVolume, currentTime); } else if (gestureSection == GestureSectionMiddle) { - adjustVolume(translation.x, initialVolume); + runSelectedGesture(@"playerGestureMiddleSelection", translation.x, initialBrightness, initialVolume, currentTime); } else if (gestureSection == GestureSectionBottom) { - adjustSeek(translation.x); + runSelectedGesture(@"playerGestureBottomSelection", translation.x, initialBrightness, initialVolume, currentTime); } } } @@ -1041,4 +1056,14 @@ typedef NS_ENUM(NSInteger, GestureSection) { if (![allKeys containsObject:@"fixCasting_enabled"]) { [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"fixCasting_enabled"]; } + // Default gestures as volume, brightness, seek + if (![allKeys containsObject:@"playerGestureTopSelection"]) { + [[NSUserDefaults standardUserDefaults] setInteger:GestureModeVolume forKey:@"playerGestureTopSelection"]; + } + if (![allKeys containsObject:@"playerGestureMiddleSelection"]) { + [[NSUserDefaults standardUserDefaults] setInteger:GestureModeBrightness forKey:@"playerGestureMiddleSelection"]; + } + if (![allKeys containsObject:@"playerGestureBottomSelection"]) { + [[NSUserDefaults standardUserDefaults] setInteger:GestureModeSeek forKey:@"playerGestureBottomSelection"]; + } } From 4602b74e6fc3d1026813a176a967fe98741fdd3b Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Thu, 15 Aug 2024 23:15:18 -0700 Subject: [PATCH 10/18] Add deadzone --- YTLitePlus.xm | 64 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/YTLitePlus.xm b/YTLitePlus.xm index 41710c9..2055fea 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -675,11 +675,24 @@ BOOL isTabSelected = NO; %property (nonatomic, retain) UIPanGestureRecognizer *YTLitePlusPanGesture; %new - (void)YTLitePlusHandlePanGesture:(UIPanGestureRecognizer *)panGestureRecognizer { + // Haptic feedback generator + static UIImpactFeedbackGenerator *feedbackGenerator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium]; + // Variables for storing initial values to be adjusted static float initialVolume; static float initialBrightness; - static BOOL isValidHorizontalPan = NO; - static GestureSection gestureSection = GestureSectionInvalid; static CGFloat currentTime; + // Flag to determine if the pan gesture is valid + static BOOL isValidHorizontalPan = NO; + // Variable to store the section of the screen the gesture is in + static GestureSection gestureSection = GestureSectionInvalid; + // Variable to track the start location of the whole pan gesture + static CGPoint startLocation; + // Variable to track the X translation when exiting the deadzone + static CGFloat deadzoneStartingXTranslation; + // Constants for the deadzone radius that can be changed in the settings + static CGFloat deadzoneRadius = 20.0; + +/***** Helper functions *****/ // Helper function to adjust brightness void (^adjustBrightness)(CGFloat, CGFloat) = ^(CGFloat translationX, CGFloat initialBrightness) { float newBrightness = initialBrightness + (translationX / 1000.0); @@ -716,9 +729,8 @@ BOOL isTabSelected = NO; [self seekToTime:seekTime]; }; // Helper function to run the selected gesture action - void (^runSelectedGesture)(NSString*, CGFloat, CGFloat, CGFloat, CGFloat) = - ^(NSString *sectionKey, CGFloat translationX, CGFloat initialBrightness, CGFloat initialVolume, CGFloat currentTime) { - + void (^runSelectedGesture)(NSString*, CGFloat, CGFloat, CGFloat, CGFloat) + = ^(NSString *sectionKey, CGFloat translationX, CGFloat initialBrightness, CGFloat initialVolume, CGFloat currentTime) { // Determine the selected gesture mode using the section key GestureMode selectedGestureMode = (GestureMode)GetSelection(sectionKey); // Handle the gesture action based on the selected mode @@ -740,12 +752,12 @@ BOOL isTabSelected = NO; break; } }; +/***** End of Helper functions *****/ - // Handle gesture based on current gesture state if (panGestureRecognizer.state == UIGestureRecognizerStateBegan) { // Get the gesture's start position - CGPoint startLocation = [panGestureRecognizer locationInView:self.view]; + startLocation = [panGestureRecognizer locationInView:self.view]; CGFloat viewHeight = self.view.bounds.size.height; // Determine the section based on the start position @@ -758,21 +770,29 @@ BOOL isTabSelected = NO; gestureSection = GestureSectionBottom; } - // Reset all starting values + // Deactive the flag isValidHorizontalPan = NO; - initialBrightness = [UIScreen mainScreen].brightness; - initialVolume = [[AVAudioSession sharedInstance] outputVolume]; - currentTime = self.currentVideoMediaTime; } - + if (panGestureRecognizer.state == UIGestureRecognizerStateChanged) { // Determine if the gesture is predominantly horizontal CGPoint translation = [panGestureRecognizer translationInView:self.view]; if (!isValidHorizontalPan) { if (fabs(translation.x) > fabs(translation.y)) { + // Check if the touch has moved outside the deadzone + CGFloat distanceFromStart = hypot(translation.x, translation.y); + if (distanceFromStart < deadzoneRadius) { + // If within the deadzone, don't activate the pan gesture + return; + } + // If outside the deadzone, activate the pan gesture and store the initial values isValidHorizontalPan = YES; + deadzoneStartingXTranslation = translation.x; + initialBrightness = [UIScreen mainScreen].brightness; + initialVolume = [[AVAudioSession sharedInstance] outputVolume]; + currentTime = self.currentVideoMediaTime; } else { - // If vertical movement is greater, cancel the gesture recognizer + // Cancel the gesture if the translation is not horizontal panGestureRecognizer.state = UIGestureRecognizerStateCancelled; return; } @@ -780,24 +800,28 @@ BOOL isTabSelected = NO; // Handle the gesture based on the identified section if (isValidHorizontalPan) { + // Adjust the X translation based on the value hit after + // exiting the deadzone + CGFloat adjustedTranslationX = translation.x - deadzoneStartingXTranslation; + // Pass the adjusted translation to the selected gesture if (gestureSection == GestureSectionTop) { - runSelectedGesture(@"playerGestureTopSelection", translation.x, initialBrightness, initialVolume, currentTime); + runSelectedGesture(@"playerGestureTopSelection", adjustedTranslationX, initialBrightness, initialVolume, currentTime); } else if (gestureSection == GestureSectionMiddle) { - runSelectedGesture(@"playerGestureMiddleSelection", translation.x, initialBrightness, initialVolume, currentTime); + runSelectedGesture(@"playerGestureMiddleSelection", adjustedTranslationX, initialBrightness, initialVolume, currentTime); } else if (gestureSection == GestureSectionBottom) { - runSelectedGesture(@"playerGestureBottomSelection", translation.x, initialBrightness, initialVolume, currentTime); + runSelectedGesture(@"playerGestureBottomSelection", adjustedTranslationX, initialBrightness, initialVolume, currentTime); } } } - + if (panGestureRecognizer.state == UIGestureRecognizerStateEnded) { if (isValidHorizontalPan) { // Provide haptic feedback upon successful gesture recognition - UINotificationFeedbackGenerator *feedbackGenerator = [[UINotificationFeedbackGenerator alloc] init]; - [feedbackGenerator notificationOccurred:UINotificationFeedbackTypeSuccess]; - feedbackGenerator = nil; + [feedbackGenerator prepare]; + [feedbackGenerator impactOccurred]; } } + } // allow the pan gesture to be recognized simultaneously with other gestures From e62699749d303b5d70519041d88e26188498051c Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Fri, 16 Aug 2024 00:25:24 -0700 Subject: [PATCH 11/18] Sensitivity and Deadzone settings --- Source/Settings.xm | 82 ++++++++++++++++++++++++++++++++++++++++++++-- YTLitePlus.h | 12 +++++++ YTLitePlus.xm | 37 ++++++++++----------- 3 files changed, 108 insertions(+), 23 deletions(-) diff --git a/Source/Settings.xm b/Source/Settings.xm index b1b1fb8..5e0cd76 100644 --- a/Source/Settings.xm +++ b/Source/Settings.xm @@ -221,7 +221,6 @@ static const NSInteger YTLiteSection = 789; } }; - // Helper to generate checkmark setting items for selecting gesture modes static YTSettingsSectionItem* (^gestureCheckmarkSettingItem)(NSInteger, NSString *) = ^(NSInteger idx, NSString *key) { return [YTSettingsSectionItemClass @@ -247,7 +246,7 @@ static const NSInteger YTLiteSection = 789; gestureCheckmarkSettingItem(1, sectionKey), gestureCheckmarkSettingItem(2, sectionKey) ]; - + // Present picker when selecting this settings item YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(sectionLabel) pickerSectionTitle:nil @@ -260,12 +259,89 @@ static const NSInteger YTLiteSection = 789; } ]; }; + // Configuration picker for deadzone to pick from 0 to 100 pixels with interval of 10 + YTSettingsSectionItem *deadzonePicker = [YTSettingsSectionItemClass + itemWithTitle:LOC(@"Deadzone (Beta)") + accessibilityIdentifier:nil + detailTextBlock:^NSString *() { + return [NSString stringWithFormat:@"%ld px", (long)GetFloat(@"playerGestureDeadzone") * 10]; + } + selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { + // Generate rows for deadzone picker + NSMutableArray *deadzoneRows = [NSMutableArray array]; + for (int i = 0; i <= 10; i++) { + [deadzoneRows addObject:[YTSettingsSectionItemClass + checkmarkItemWithTitle:[NSString stringWithFormat:@"%ld px", (long)i * 10] + selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { + [[NSUserDefaults standardUserDefaults] setInteger:i forKey:@"playerGestureDeadzone"]; + [settingsViewController reloadData]; + return YES; + } + ]]; + } + // Present deadzone picker when selecting this settings item + YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] + initWithNavTitle:LOC(@"Deadzone (Beta)") + pickerSectionTitle:nil + rows:deadzoneRows + selectedItemIndex:GetFloat(@"playerGestureDeadzone") + parentResponder:[self parentResponder] + ]; + [settingsViewController pushViewController:picker]; + return YES; + } + ]; + // Configuration picker for sensitivity to pick from 0.5 to 2.0 with interval of 0.1 + YTSettingsSectionItem *sensitivtyPicker = [YTSettingsSectionItemClass + itemWithTitle:LOC(@"Sensitivity (Beta)") + accessibilityIdentifier:nil + detailTextBlock:^NSString *() { + return [NSString stringWithFormat:@"%.1f", GetFloat(@"playerGestureSensitivity") * 0.1 + 0.5]; + } + selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { + // Generate rows for sensitivity picker + NSMutableArray *sensitivityRows = [NSMutableArray array]; + for (int i = 5; i <= 20; i++) { + [sensitivityRows addObject:[YTSettingsSectionItemClass + checkmarkItemWithTitle:[NSString stringWithFormat:@"%.1f", i * 0.1] + selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { + [[NSUserDefaults standardUserDefaults] setInteger:i forKey:@"playerGestureSensitivity"]; + [settingsViewController reloadData]; + return YES; + } + ]]; + } + // Present sensitivity picker + YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] + initWithNavTitle:LOC(@"Sensitivity (Beta)") + pickerSectionTitle:nil + rows:sensitivityRows + selectedItemIndex:GetFloat(@"playerGestureSensitivity") + parentResponder:[self parentResponder] + ]; + [settingsViewController pushViewController:picker]; + return YES; + } + ] + + // High level gestures menu YTSettingsSectionItem *playerGesturesGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"Player Gestures (Beta)") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { NSArray *rows = @[ + // Description header item + [YTSettingsSectionItemClass + itemWithTitle:nil + accessibilityIdentifier:nil + detailTextBlock:LOC(@"Configure horizontal pan gestures for the player.") + selectBlock:nil + ], + // Pickers for each gesture section createSectionGestureSelector(@"Top Section (Beta)", @"playerGestureTopSelection"), createSectionGestureSelector(@"Middle Section (Beta)", @"playerGestureMiddleSelection"), - createSectionGestureSelector(@"Bottom Section (Beta)", @"playerGestureBottomSelection") + createSectionGestureSelector(@"Bottom Section (Beta)", @"playerGestureBottomSelection"), + // Pickers for configuration settings + deadzonePicker, + sensitivityPicker ]; YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"Player Gestures (Beta)") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]]; [settingsViewController pushViewController:picker]; diff --git a/YTLitePlus.h b/YTLitePlus.h index 9261cfe..52ac085 100644 --- a/YTLitePlus.h +++ b/YTLitePlus.h @@ -58,6 +58,7 @@ // Helper methods for key retrieval #define IsEnabled(key) [[NSUserDefaults standardUserDefaults] boolForKey:key] #define GetSelection(key) [[NSUserDefaults standardUserDefaults] integerForKey:key] +#define GetFloat(key) [[NSUserDefaults standardUserDefaults] floatForKey:key] // Player Gesture selected mode enum @@ -149,6 +150,17 @@ typedef NS_ENUM(NSUInteger, GestureSection) { @property id parentResponder; @end +// Player Gestures - @bhackel +@interface YTPlayerViewController (YTLitePlus) +@property (nonatomic, retain) UIPanGestureRecognizer *YTLitePlusPanGesture; +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer; +@end +@interface YTWatchFullscreenViewController : YTMultiSizeViewController +@end +@interface MPVolumeController : NSObject +@property (nonatomic, assign, readwrite) float volumeValue; +@end + // Hide Collapse Button - @arichornlover @interface YTMainAppControlsOverlayView (YTLitePlus) @property (nonatomic, assign, readwrite) YTQTMButton *watchCollapseButton; diff --git a/YTLitePlus.xm b/YTLitePlus.xm index 2055fea..fed5597 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -640,17 +640,6 @@ BOOL isTabSelected = NO; } %end -@interface YTPlayerViewController (YTLitePlus) -// the long press gesture that will be created and added to the player view -@property (nonatomic, retain) UIPanGestureRecognizer *YTLitePlusPanGesture; -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer; -@end -@interface YTWatchFullscreenViewController : YTMultiSizeViewController -@end -@interface MPVolumeController : NSObject -@property (nonatomic, assign, readwrite) float volumeValue; -@end - // Gestures - @bhackel %group playerGestures %hook YTWatchLayerViewController @@ -689,19 +678,21 @@ BOOL isTabSelected = NO; static CGPoint startLocation; // Variable to track the X translation when exiting the deadzone static CGFloat deadzoneStartingXTranslation; - // Constants for the deadzone radius that can be changed in the settings - static CGFloat deadzoneRadius = 20.0; + // Constant for the deadzone radius that can be changed in the settings + static CGFloat deadzoneRadius = (CGFloat)GetFloat(@"playerGesturesDeadzone"); + // Constant for the sensitivity factor that can be changed in the settings + static CGFloat sensitivityFactor = (CGFloat)GetFloat(@"playerGestureSensitivity"); /***** Helper functions *****/ // Helper function to adjust brightness void (^adjustBrightness)(CGFloat, CGFloat) = ^(CGFloat translationX, CGFloat initialBrightness) { - float newBrightness = initialBrightness + (translationX / 1000.0); + float newBrightness = initialBrightness + ((translationX / 1000.0) * sensitivityFactor); newBrightness = fmaxf(fminf(newBrightness, 1.0), 0.0); [[UIScreen mainScreen] setBrightness:newBrightness]; }; // Helper function to adjust volume void (^adjustVolume)(CGFloat, CGFloat) = ^(CGFloat translationX, CGFloat initialVolume) { - float newVolume = initialVolume + (translationX / 1000.0); + float newVolume = initialVolume + ((translationX / 1000.0) * sensitivityFactor); newVolume = fmaxf(fminf(newVolume, 1.0), 0.0); // https://stackoverflow.com/questions/50737943/how-to-change-volume-programmatically-on-ios-11-4 MPVolumeView *volumeView = [[MPVolumeView alloc] init]; @@ -769,8 +760,7 @@ BOOL isTabSelected = NO; } else if (startLocation.y <= viewHeight) { gestureSection = GestureSectionBottom; } - - // Deactive the flag + // Deactive the activity flag isValidHorizontalPan = NO; } @@ -791,6 +781,9 @@ BOOL isTabSelected = NO; initialBrightness = [UIScreen mainScreen].brightness; initialVolume = [[AVAudioSession sharedInstance] outputVolume]; currentTime = self.currentVideoMediaTime; + // Provide haptic feedback to indicate a gesture start + [feedbackGenerator prepare]; + [feedbackGenerator impactOccurred]; } else { // Cancel the gesture if the translation is not horizontal panGestureRecognizer.state = UIGestureRecognizerStateCancelled; @@ -813,7 +806,6 @@ BOOL isTabSelected = NO; } } } - if (panGestureRecognizer.state == UIGestureRecognizerStateEnded) { if (isValidHorizontalPan) { // Provide haptic feedback upon successful gesture recognition @@ -823,13 +815,11 @@ BOOL isTabSelected = NO; } } - // allow the pan gesture to be recognized simultaneously with other gestures %new - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { return YES; } - %end %end @@ -1090,4 +1080,11 @@ BOOL isTabSelected = NO; if (![allKeys containsObject:@"playerGestureBottomSelection"]) { [[NSUserDefaults standardUserDefaults] setInteger:GestureModeSeek forKey:@"playerGestureBottomSelection"]; } + // Default configuration options for gestures + if (![allKeys containsObject:@"playerGesturesDeadzone"]) { + [[NSUserDefaults standardUserDefaults] setFloat:20.0 forKey:@"playerGesturesDeadzone"]; + } + if (![allKeys containsObject:@"playerGestureSensitivity"]) { + [[NSUserDefaults standardUserDefaults] setFloat:1.0 forKey:@"playerGestureSensitivity"]; + } } From e21e026c30041317f329acdce88173dc0ee1e97b Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Fri, 16 Aug 2024 00:32:22 -0700 Subject: [PATCH 12/18] Fix compile --- Source/Settings.xm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/Settings.xm b/Source/Settings.xm index 5e0cd76..a974503 100644 --- a/Source/Settings.xm +++ b/Source/Settings.xm @@ -292,7 +292,7 @@ static const NSInteger YTLiteSection = 789; } ]; // Configuration picker for sensitivity to pick from 0.5 to 2.0 with interval of 0.1 - YTSettingsSectionItem *sensitivtyPicker = [YTSettingsSectionItemClass + YTSettingsSectionItem *sensitivityPicker = [YTSettingsSectionItemClass itemWithTitle:LOC(@"Sensitivity (Beta)") accessibilityIdentifier:nil detailTextBlock:^NSString *() { @@ -322,8 +322,7 @@ static const NSInteger YTLiteSection = 789; [settingsViewController pushViewController:picker]; return YES; } - ] - + ]; // High level gestures menu YTSettingsSectionItem *playerGesturesGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"Player Gestures (Beta)") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { @@ -332,7 +331,9 @@ static const NSInteger YTLiteSection = 789; [YTSettingsSectionItemClass itemWithTitle:nil accessibilityIdentifier:nil - detailTextBlock:LOC(@"Configure horizontal pan gestures for the player.") + detailTextBlock:^NSString *() { + return LOC(@"Configure horizontal pan gestures for the player."); + } selectBlock:nil ], // Pickers for each gesture section From e63bc374cf8ed56641f4584e11b18d5a66e97b21 Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Fri, 16 Aug 2024 01:13:22 -0700 Subject: [PATCH 13/18] Fix defaults and text descriptions --- Source/Settings.xm | 83 ++++++++++++------- YTLitePlus.xm | 6 +- .../ar.lproj/Localizable.strings | 3 + .../bg.lproj/Localizable.strings | 3 + .../de.lproj/Localizable.strings | 3 + .../en.lproj/Localizable.strings | 3 + .../es.lproj/Localizable.strings | 3 + .../fr.lproj/Localizable.strings | 3 + .../ja.lproj/Localizable.strings | 3 + .../pt.lproj/Localizable.strings | 3 + .../ro.lproj/Localizable.strings | 3 + .../ru.lproj/Localizable.strings | 3 + .../template.lproj/Localizable.strings | 3 + .../tr.lproj/Localizable.strings | 3 + .../vi.lproj/Localizable.strings | 3 + .../zh_TW.lproj/Localizable.strings | 3 + 16 files changed, 100 insertions(+), 31 deletions(-) diff --git a/Source/Settings.xm b/Source/Settings.xm index a974503..2c0e14b 100644 --- a/Source/Settings.xm +++ b/Source/Settings.xm @@ -211,11 +211,11 @@ static const NSInteger YTLiteSection = 789; static NSString* (^sectionGestureSelectedModeToString)(GestureMode) = ^(GestureMode sectionIndex) { switch (sectionIndex) { case GestureModeVolume: - return LOC(@"Volume (Beta)"); + return LOC(@"Volume"); case GestureModeBrightness: - return LOC(@"Brightness (Beta)"); + return LOC(@"Brightness"); case GestureModeSeek: - return LOC(@"Seek (Beta)"); + return LOC(@"Seek"); default: return @"Invalid index - Report bug"; } @@ -260,86 +260,114 @@ static const NSInteger YTLiteSection = 789; ]; }; // Configuration picker for deadzone to pick from 0 to 100 pixels with interval of 10 + NSMutableArray *deadzoneValues = [NSMutableArray array]; + for (CGFloat value = 0; value <= 100; value += 10) { + [deadzoneValues addObject:@(value)]; + } YTSettingsSectionItem *deadzonePicker = [YTSettingsSectionItemClass - itemWithTitle:LOC(@"Deadzone (Beta)") + itemWithTitle:LOC(@"Deadzone") + titleDescription:LOC(@"Minimum distance to move before a gesture is recognized") accessibilityIdentifier:nil detailTextBlock:^NSString *() { - return [NSString stringWithFormat:@"%ld px", (long)GetFloat(@"playerGestureDeadzone") * 10]; + return [NSString stringWithFormat:@"%ld px", (long)GetFloat(@"playerGesturesDeadzone")]; } selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { - // Generate rows for deadzone picker + // Generate rows for deadzone picker using the predefined array NSMutableArray *deadzoneRows = [NSMutableArray array]; - for (int i = 0; i <= 10; i++) { + for (NSNumber *deadzoneValue in deadzoneValues) { + CGFloat deadzone = [deadzoneValue floatValue]; [deadzoneRows addObject:[YTSettingsSectionItemClass - checkmarkItemWithTitle:[NSString stringWithFormat:@"%ld px", (long)i * 10] + checkmarkItemWithTitle:[NSString stringWithFormat:@"%ld px", (long)deadzone] selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { - [[NSUserDefaults standardUserDefaults] setInteger:i forKey:@"playerGestureDeadzone"]; + [[NSUserDefaults standardUserDefaults] setFloat:deadzone forKey:@"playerGesturesDeadzone"]; [settingsViewController reloadData]; return YES; } ]]; } + // Determine the index of the currently selected deadzone + CGFloat currentDeadzone = GetFloat(@"playerGesturesDeadzone"); + NSUInteger selectedIndex = [deadzoneValues indexOfObject:@(currentDeadzone)]; + if (selectedIndex == NSNotFound) { + selectedIndex = 0; // Default to the first item if the current deadzone is not found + } // Present deadzone picker when selecting this settings item YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] - initWithNavTitle:LOC(@"Deadzone (Beta)") + initWithNavTitle:LOC(@"Deadzone") pickerSectionTitle:nil rows:deadzoneRows - selectedItemIndex:GetFloat(@"playerGestureDeadzone") + selectedItemIndex:selectedIndex parentResponder:[self parentResponder] ]; [settingsViewController pushViewController:picker]; return YES; } ]; + [sectionItems addObject:deadzonePicker]; + // Configuration picker for sensitivity to pick from 0.5 to 2.0 with interval of 0.1 + NSMutableArray *sensitivityValues = [NSMutableArray array]; + for (CGFloat value = 0.5; value <= 2.0; value += 0.1) { + [sensitivityValues addObject:@(value)]; + } YTSettingsSectionItem *sensitivityPicker = [YTSettingsSectionItemClass - itemWithTitle:LOC(@"Sensitivity (Beta)") + itemWithTitle:LOC(@"Sensitivity") + titleDescription:LOC(@"Multiplier on volume and brightness gestures") accessibilityIdentifier:nil detailTextBlock:^NSString *() { - return [NSString stringWithFormat:@"%.1f", GetFloat(@"playerGestureSensitivity") * 0.1 + 0.5]; + return [NSString stringWithFormat:@"%.1f", GetFloat(@"playerGesturesSensitivity")]; } selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { - // Generate rows for sensitivity picker + // Generate rows for sensitivity picker using the predefined array NSMutableArray *sensitivityRows = [NSMutableArray array]; - for (int i = 5; i <= 20; i++) { + for (NSNumber *sensitivityValue in sensitivityValues) { + CGFloat sensitivity = [sensitivityValue floatValue]; [sensitivityRows addObject:[YTSettingsSectionItemClass - checkmarkItemWithTitle:[NSString stringWithFormat:@"%.1f", i * 0.1] + checkmarkItemWithTitle:[NSString stringWithFormat:@"%.1f", sensitivity] selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { - [[NSUserDefaults standardUserDefaults] setInteger:i forKey:@"playerGestureSensitivity"]; + [[NSUserDefaults standardUserDefaults] setFloat:sensitivity forKey:@"playerGesturesSensitivity"]; [settingsViewController reloadData]; return YES; } ]]; } + // Determine the index of the currently selected sensitivity + CGFloat currentSensitivity = GetFloat(@"playerGesturesSensitivity"); + NSUInteger selectedIndex = [sensitivityValues indexOfObject:@(currentSensitivity)]; + if (selectedIndex == NSNotFound) { + selectedIndex = 0; // Default to the first item if the current sensitivity is not found + } // Present sensitivity picker YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] - initWithNavTitle:LOC(@"Sensitivity (Beta)") + initWithNavTitle:LOC(@"Sensitivity") pickerSectionTitle:nil rows:sensitivityRows - selectedItemIndex:GetFloat(@"playerGestureSensitivity") + selectedItemIndex:selectedIndex parentResponder:[self parentResponder] ]; [settingsViewController pushViewController:picker]; return YES; } ]; + [sectionItems addObject:sensitivityPicker]; // High level gestures menu YTSettingsSectionItem *playerGesturesGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"Player Gestures (Beta)") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { NSArray *rows = @[ // Description header item [YTSettingsSectionItemClass - itemWithTitle:nil - accessibilityIdentifier:nil - detailTextBlock:^NSString *() { - return LOC(@"Configure horizontal pan gestures for the player."); - } + itemWithTitle:nil + titleDescription:LOC(@"Configure horizontal pan gestures for the player.") + accessibilityIdentifier:nil + detailTextBlock:nil selectBlock:nil ], + // Toggle for enabling gestures + BASIC_SWITCH(LOC(@"PLAYER_GESTURES_TOGGLE"), nil, @"playerGestures_enabled"), // Pickers for each gesture section - createSectionGestureSelector(@"Top Section (Beta)", @"playerGestureTopSelection"), - createSectionGestureSelector(@"Middle Section (Beta)", @"playerGestureMiddleSelection"), - createSectionGestureSelector(@"Bottom Section (Beta)", @"playerGestureBottomSelection"), + createSectionGestureSelector(@"Top Section", @"playerGestureTopSelection"), + createSectionGestureSelector(@"Middle Section", @"playerGestureMiddleSelection"), + createSectionGestureSelector(@"Bottom Section", @"playerGestureBottomSelection"), // Pickers for configuration settings deadzonePicker, sensitivityPicker @@ -372,7 +400,6 @@ static const NSInteger YTLiteSection = 789; BASIC_SWITCH(LOC(@"HIDE_HUD_MESSAGES"), LOC(@"HIDE_HUD_MESSAGES_DESC"), @"hideHUD_enabled"), BASIC_SWITCH(LOC(@"HIDE_COLLAPSE_BUTTON"), LOC(@"HIDE_COLLAPSE_BUTTON_DESC"), @"disableCollapseButton_enabled"), BASIC_SWITCH(LOC(@"HIDE_SPEED_TOAST"), LOC(@"HIDE_SPEED_TOAST_DESC"), @"hideSpeedToast_enabled"), - BASIC_SWITCH(LOC(@"ENABLE_UYOU_GESTURES"), LOC(@"ENABLE_UYOU_GESTURES_DESC"), @"playerGestures_enabled"), ]; YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"VIDEO_CONTROLS_OVERLAY_OPTIONS") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]]; [settingsViewController pushViewController:picker]; diff --git a/YTLitePlus.xm b/YTLitePlus.xm index fed5597..fc8e947 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -681,7 +681,7 @@ BOOL isTabSelected = NO; // Constant for the deadzone radius that can be changed in the settings static CGFloat deadzoneRadius = (CGFloat)GetFloat(@"playerGesturesDeadzone"); // Constant for the sensitivity factor that can be changed in the settings - static CGFloat sensitivityFactor = (CGFloat)GetFloat(@"playerGestureSensitivity"); + static CGFloat sensitivityFactor = (CGFloat)GetFloat(@"playerGesturesSensitivity"); /***** Helper functions *****/ // Helper function to adjust brightness @@ -1084,7 +1084,7 @@ BOOL isTabSelected = NO; if (![allKeys containsObject:@"playerGesturesDeadzone"]) { [[NSUserDefaults standardUserDefaults] setFloat:20.0 forKey:@"playerGesturesDeadzone"]; } - if (![allKeys containsObject:@"playerGestureSensitivity"]) { - [[NSUserDefaults standardUserDefaults] setFloat:1.0 forKey:@"playerGestureSensitivity"]; + if (![allKeys containsObject:@"playerGesturesSensitivity"]) { + [[NSUserDefaults standardUserDefaults] setFloat:1.0 forKey:@"playerGesturesSensitivity"]; } } diff --git a/lang/YTLitePlus.bundle/ar.lproj/Localizable.strings b/lang/YTLitePlus.bundle/ar.lproj/Localizable.strings index ce93d10..88493c7 100644 --- a/lang/YTLitePlus.bundle/ar.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/ar.lproj/Localizable.strings @@ -13,6 +13,9 @@ "REPLACE_COPY_AND_PASTE_BUTTONS" = "Replace 'Copy Settings' & 'Paste Settings' Buttons"; "REPLACE_COPY_AND_PASTE_BUTTONS_DESC" = "Replaces the Buttons to 'Export Settings' and 'Import Settings'"; +// Player Gestures +"PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "خيارات تراكب ضوابط الفيديو"; diff --git a/lang/YTLitePlus.bundle/bg.lproj/Localizable.strings b/lang/YTLitePlus.bundle/bg.lproj/Localizable.strings index 076d430..a5dbeda 100644 --- a/lang/YTLitePlus.bundle/bg.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/bg.lproj/Localizable.strings @@ -13,6 +13,9 @@ "REPLACE_COPY_AND_PASTE_BUTTONS" = "Заменете бутоните 'Копиране на настройки' и 'Поставяне на настройки'"; "REPLACE_COPY_AND_PASTE_BUTTONS_DESC" = "Заменете бутоните с 'Експортиране на настройки' и 'Импортиране на настройки'"; +// Player Gestures +"PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Опции за контрол на видеото"; diff --git a/lang/YTLitePlus.bundle/de.lproj/Localizable.strings b/lang/YTLitePlus.bundle/de.lproj/Localizable.strings index da044fe..07b2ada 100644 --- a/lang/YTLitePlus.bundle/de.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/de.lproj/Localizable.strings @@ -13,6 +13,9 @@ "REPLACE_COPY_AND_PASTE_BUTTONS" = "Replace 'Copy Settings' & 'Paste Settings' Buttons"; "REPLACE_COPY_AND_PASTE_BUTTONS_DESC" = "Replaces the Buttons to 'Export Settings' and 'Import Settings'"; +// Player Gestures +"PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Overlay-Optionen für Videosteuerungen"; diff --git a/lang/YTLitePlus.bundle/en.lproj/Localizable.strings b/lang/YTLitePlus.bundle/en.lproj/Localizable.strings index 4af6499..618bcb2 100644 --- a/lang/YTLitePlus.bundle/en.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/en.lproj/Localizable.strings @@ -13,6 +13,9 @@ "REPLACE_COPY_AND_PASTE_BUTTONS" = "Replace 'Copy Settings' & 'Paste Settings' Buttons"; "REPLACE_COPY_AND_PASTE_BUTTONS_DESC" = "Replaces the Buttons to 'Export Settings' and 'Import Settings'"; +// Player Gestures +"PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Controls Overlay Options"; diff --git a/lang/YTLitePlus.bundle/es.lproj/Localizable.strings b/lang/YTLitePlus.bundle/es.lproj/Localizable.strings index 83a74d7..69d06dd 100644 --- a/lang/YTLitePlus.bundle/es.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/es.lproj/Localizable.strings @@ -13,6 +13,9 @@ "REPLACE_COPY_AND_PASTE_BUTTONS" = "Replace 'Copy Settings' & 'Paste Settings' Buttons"; "REPLACE_COPY_AND_PASTE_BUTTONS_DESC" = "Replaces the Buttons to 'Export Settings' and 'Import Settings'"; +// Player Gestures +"PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Opciones de superposición de controles de vídeo"; diff --git a/lang/YTLitePlus.bundle/fr.lproj/Localizable.strings b/lang/YTLitePlus.bundle/fr.lproj/Localizable.strings index 74e2201..f5b24b8 100644 --- a/lang/YTLitePlus.bundle/fr.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/fr.lproj/Localizable.strings @@ -13,6 +13,9 @@ "REPLACE_COPY_AND_PASTE_BUTTONS" = "Replace 'Copy Settings' & 'Paste Settings' Buttons"; "REPLACE_COPY_AND_PASTE_BUTTONS_DESC" = "Replaces the Buttons to 'Export Settings' and 'Import Settings'"; +// Player Gestures +"PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Options de l'overlay des contrôles vidéo"; diff --git a/lang/YTLitePlus.bundle/ja.lproj/Localizable.strings b/lang/YTLitePlus.bundle/ja.lproj/Localizable.strings index 6400844..5dd4f3c 100644 --- a/lang/YTLitePlus.bundle/ja.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/ja.lproj/Localizable.strings @@ -13,6 +13,9 @@ "REPLACE_COPY_AND_PASTE_BUTTONS" = "Replace 'Copy Settings' & 'Paste Settings' Buttons"; "REPLACE_COPY_AND_PASTE_BUTTONS_DESC" = "Replaces the Buttons to 'Export Settings' and 'Import Settings'"; +// Player Gestures +"PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "動画コントロールオーバーレイの設定"; diff --git a/lang/YTLitePlus.bundle/pt.lproj/Localizable.strings b/lang/YTLitePlus.bundle/pt.lproj/Localizable.strings index f9200e3..c8e734d 100644 --- a/lang/YTLitePlus.bundle/pt.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/pt.lproj/Localizable.strings @@ -13,6 +13,9 @@ "REPLACE_COPY_AND_PASTE_BUTTONS" = "Substituir os Botões 'Copiar Configurações' e 'Colar Configurações'"; "REPLACE_COPY_AND_PASTE_BUTTONS_DESC" = "Substitui os Botões 'Exportar Configurações' e 'Importar Configurações'"; +// Player Gestures +"PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Opções de Sobreposição de Controles de Vídeo"; diff --git a/lang/YTLitePlus.bundle/ro.lproj/Localizable.strings b/lang/YTLitePlus.bundle/ro.lproj/Localizable.strings index fac3b20..3be083e 100644 --- a/lang/YTLitePlus.bundle/ro.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/ro.lproj/Localizable.strings @@ -13,6 +13,9 @@ "REPLACE_COPY_AND_PASTE_BUTTONS" = "Replace 'Copy Settings' & 'Paste Settings' Buttons"; "REPLACE_COPY_AND_PASTE_BUTTONS_DESC" = "Replaces the Buttons to 'Export Settings' and 'Import Settings'"; +// Player Gestures +"PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Opțiuni Overlay Controale Video"; diff --git a/lang/YTLitePlus.bundle/ru.lproj/Localizable.strings b/lang/YTLitePlus.bundle/ru.lproj/Localizable.strings index 11889b4..0efbea6 100644 --- a/lang/YTLitePlus.bundle/ru.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/ru.lproj/Localizable.strings @@ -13,6 +13,9 @@ "REPLACE_COPY_AND_PASTE_BUTTONS" = "Replace 'Copy Settings' & 'Paste Settings' Buttons"; "REPLACE_COPY_AND_PASTE_BUTTONS_DESC" = "Replaces the Buttons to 'Export Settings' and 'Import Settings'"; +// Player Gestures +"PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Controls Overlay Options"; diff --git a/lang/YTLitePlus.bundle/template.lproj/Localizable.strings b/lang/YTLitePlus.bundle/template.lproj/Localizable.strings index 473514e..5efa1cd 100644 --- a/lang/YTLitePlus.bundle/template.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/template.lproj/Localizable.strings @@ -28,6 +28,9 @@ https://github.com/PoomSmart/Return-YouTube-Dislikes/tree/main/layout/Library/Ap "REPLACE_COPY_AND_PASTE_BUTTONS" = "Replace 'Copy Settings' & 'Paste Settings' Buttons"; "REPLACE_COPY_AND_PASTE_BUTTONS_DESC" = "Replaces the Buttons to 'Export Settings' and 'Import Settings'"; +// Player Gestures +"PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Controls Overlay Options"; diff --git a/lang/YTLitePlus.bundle/tr.lproj/Localizable.strings b/lang/YTLitePlus.bundle/tr.lproj/Localizable.strings index 62afeea..815d24a 100644 --- a/lang/YTLitePlus.bundle/tr.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/tr.lproj/Localizable.strings @@ -13,6 +13,9 @@ "REPLACE_COPY_AND_PASTE_BUTTONS" = "'Ayarları Kopyala' ve 'Ayarları Yapıştır' Düğmelerini Değiştir"; "REPLACE_COPY_AND_PASTE_BUTTONS_DESC" = "Düğmeleri 'Ayarları Dışa Aktar' ve 'Ayarları İçe Aktar' ile değiştirir"; +// Player Gestures +"PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Kontrol Seç."; diff --git a/lang/YTLitePlus.bundle/vi.lproj/Localizable.strings b/lang/YTLitePlus.bundle/vi.lproj/Localizable.strings index d8dea0e..af9750c 100644 --- a/lang/YTLitePlus.bundle/vi.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/vi.lproj/Localizable.strings @@ -13,6 +13,9 @@ "REPLACE_COPY_AND_PASTE_BUTTONS" = "Replace 'Copy Settings' & 'Paste Settings' Buttons"; "REPLACE_COPY_AND_PASTE_BUTTONS_DESC" = "Replaces the Buttons to 'Export Settings' and 'Import Settings'"; +// Player Gestures +"PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; + // Video player options "VIDEO_PLAYER_OPTIONS" = "Tùy chọn trình phát video"; diff --git a/lang/YTLitePlus.bundle/zh_TW.lproj/Localizable.strings b/lang/YTLitePlus.bundle/zh_TW.lproj/Localizable.strings index 7fd520a..47ef9c2 100644 --- a/lang/YTLitePlus.bundle/zh_TW.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/zh_TW.lproj/Localizable.strings @@ -14,6 +14,9 @@ "REPLACE_COPY_AND_PASTE_BUTTONS" = "Replace 'Copy Settings' & 'Paste Settings' Buttons"; "REPLACE_COPY_AND_PASTE_BUTTONS_DESC" = "Replaces the Buttons to 'Export Settings' and 'Import Settings'"; +// Player Gestures +"PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; + // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "影片區覆蓋按鈕設定"; From 36f9da844b230f76f5400b49f4ac46c95bb77d93 Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Fri, 16 Aug 2024 09:27:09 -0700 Subject: [PATCH 14/18] Add disable option --- Source/Settings.xm | 11 ++++++----- YTLitePlus.h | 2 +- YTLitePlus.xm | 24 ++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Source/Settings.xm b/Source/Settings.xm index 2c0e14b..f45faef 100644 --- a/Source/Settings.xm +++ b/Source/Settings.xm @@ -216,6 +216,8 @@ static const NSInteger YTLiteSection = 789; return LOC(@"Brightness"); case GestureModeSeek: return LOC(@"Seek"); + case GestureModeDisabled: + return LOC(@"Disabled"); default: return @"Invalid index - Report bug"; } @@ -242,9 +244,10 @@ static const NSInteger YTLiteSection = 789; } selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { NSArray *rows = @[ - gestureCheckmarkSettingItem(0, sectionKey), - gestureCheckmarkSettingItem(1, sectionKey), - gestureCheckmarkSettingItem(2, sectionKey) + gestureCheckmarkSettingItem(0, sectionKey), // Volume + gestureCheckmarkSettingItem(1, sectionKey), // Brightness + gestureCheckmarkSettingItem(2, sectionKey), // Seek + gestureCheckmarkSettingItem(3, sectionKey) // Disabled ]; // Present picker when selecting this settings item YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] @@ -303,7 +306,6 @@ static const NSInteger YTLiteSection = 789; return YES; } ]; - [sectionItems addObject:deadzonePicker]; // Configuration picker for sensitivity to pick from 0.5 to 2.0 with interval of 0.1 NSMutableArray *sensitivityValues = [NSMutableArray array]; @@ -349,7 +351,6 @@ static const NSInteger YTLiteSection = 789; return YES; } ]; - [sectionItems addObject:sensitivityPicker]; // High level gestures menu YTSettingsSectionItem *playerGesturesGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"Player Gestures (Beta)") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { diff --git a/YTLitePlus.h b/YTLitePlus.h index 52ac085..07f416f 100644 --- a/YTLitePlus.h +++ b/YTLitePlus.h @@ -66,7 +66,7 @@ typedef NS_ENUM(NSUInteger, GestureMode) { GestureModeVolume, GestureModeBrightness, GestureModeSeek, - GestureModeInvalid + GestureModeDisabled }; // Gesture Section Enum typedef NS_ENUM(NSUInteger, GestureSection) { diff --git a/YTLitePlus.xm b/YTLitePlus.xm index fc8e947..61b9935 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -735,7 +735,11 @@ BOOL isTabSelected = NO; case GestureModeSeek: adjustSeek(translationX, currentTime); break; + case GestureModeDisabled: + // Do nothing if the gesture is disabled + break; default: + // Show an alert if the gesture mode is invalid UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Invalid Gesture Mode" message:@"Please report this bug." preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; [alertController addAction:okAction]; @@ -755,10 +759,27 @@ BOOL isTabSelected = NO; // by dividing the view into thirds if (startLocation.y <= viewHeight / 3.0) { gestureSection = GestureSectionTop; + // Cancel the gesture if the mode is disabled + if (GetSelection(@"playerGestureTopSelection") == GestureModeDisabled) { + panGestureRecognizer.state = UIGestureRecognizerStateCancelled; + return; + } } else if (startLocation.y <= 2 * viewHeight / 3.0) { gestureSection = GestureSectionMiddle; + // Cancel the gesture if the mode is disabled + if (GetSelection(@"playerGestureMiddleSelection") == GestureModeDisabled) { + panGestureRecognizer.state = UIGestureRecognizerStateCancelled; + return; + } } else if (startLocation.y <= viewHeight) { gestureSection = GestureSectionBottom; + // Cancel the gesture if the mode is disabled + if (GetSelection(@"playerGestureBottomSelection") == GestureModeDisabled) { + panGestureRecognizer.state = UIGestureRecognizerStateCancelled; + return; + } + } else { + gestureSection = GestureSectionInvalid; } // Deactive the activity flag isValidHorizontalPan = NO; @@ -803,6 +824,9 @@ BOOL isTabSelected = NO; runSelectedGesture(@"playerGestureMiddleSelection", adjustedTranslationX, initialBrightness, initialVolume, currentTime); } else if (gestureSection == GestureSectionBottom) { runSelectedGesture(@"playerGestureBottomSelection", adjustedTranslationX, initialBrightness, initialVolume, currentTime); + } else { + // If the section is invalid, cancel the gesture + panGestureRecognizer.state = UIGestureRecognizerStateCancelled; } } } From 023fafae15be7b13a28b78dfd78c625db729afe8 Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Sun, 18 Aug 2024 18:17:32 -0700 Subject: [PATCH 15/18] Added YouLoop submodule to Tweaks/ folder --- .gitmodules | 3 +++ Makefile | 5 +++-- Tweaks/YouLoop | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) create mode 160000 Tweaks/YouLoop diff --git a/.gitmodules b/.gitmodules index e52c366..6d35fdf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -55,3 +55,6 @@ [submodule "Tweaks/YouTimeStamp"] path = Tweaks/YouTimeStamp url = https://github.com/arichornloverALT/YouTimeStamp.git +[submodule "Tweaks/YouLoop"] + path = Tweaks/YouLoop + url = https://github.com/bhackel/YouLoop diff --git a/Makefile b/Makefile index 8400c15..3046c62 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ EXTRA_CFLAGS := $(addprefix -I,$(shell find Tweaks/FLEX -name '*.h' -exec dirnam # Allow YouTubeHeader to be accessible using #include <...> export ADDITIONAL_CFLAGS = -I$(THEOS_PROJECT_DIR)/Tweaks -YTLitePlus_INJECT_DYLIBS = Tweaks/YTLite/var/jb/Library/MobileSubstrate/DynamicLibraries/YTLite.dylib .theos/obj/libcolorpicker.dylib .theos/obj/iSponsorBlock.dylib .theos/obj/YTUHD.dylib .theos/obj/YouPiP.dylib .theos/obj/YouTubeDislikesReturn.dylib .theos/obj/YTABConfig.dylib .theos/obj/YouMute.dylib .theos/obj/DontEatMyContent.dylib .theos/obj/YTHoldForSpeed.dylib .theos/obj/YTVideoOverlay.dylib .theos/obj/YouGroupSettings.dylib .theos/obj/YouQuality.dylib .theos/obj/YouTimeStamp.dylib +YTLitePlus_INJECT_DYLIBS = Tweaks/YTLite/var/jb/Library/MobileSubstrate/DynamicLibraries/YTLite.dylib .theos/obj/libcolorpicker.dylib .theos/obj/iSponsorBlock.dylib .theos/obj/YTUHD.dylib .theos/obj/YouPiP.dylib .theos/obj/YouTubeDislikesReturn.dylib .theos/obj/YTABConfig.dylib .theos/obj/YouMute.dylib .theos/obj/DontEatMyContent.dylib .theos/obj/YTHoldForSpeed.dylib .theos/obj/YTVideoOverlay.dylib .theos/obj/YouGroupSettings.dylib .theos/obj/YouQuality.dylib .theos/obj/YouTimeStamp.dylib .theos/obj/YouLoop.dylib YTLitePlus_FILES = YTLitePlus.xm $(shell find Source -name '*.xm' -o -name '*.x' -o -name '*.m') $(shell find Tweaks/FLEX -type f \( -iname \*.c -o -iname \*.m -o -iname \*.mm \)) YTLitePlus_IPA = ./tmp/Payload/YouTube.app YTLitePlus_CFLAGS = -fobjc-arc -Wno-deprecated-declarations -Wno-unsupported-availability-guard -Wno-unused-but-set-variable -DTWEAK_VERSION=$(PACKAGE_VERSION) $(EXTRA_CFLAGS) @@ -23,7 +23,7 @@ YTLitePlus_FRAMEWORKS = UIKit Security include $(THEOS)/makefiles/common.mk include $(THEOS_MAKE_PATH)/tweak.mk -SUBPROJECTS += Tweaks/Alderis Tweaks/iSponsorBlock Tweaks/YTUHD Tweaks/YouPiP Tweaks/Return-YouTube-Dislikes Tweaks/YTABConfig Tweaks/YouMute Tweaks/DontEatMyContent Tweaks/YTHoldForSpeed Tweaks/YTVideoOverlay Tweaks/YouQuality Tweaks/YouTimeStamp Tweaks/YouGroupSettings +SUBPROJECTS += Tweaks/Alderis Tweaks/iSponsorBlock Tweaks/YTUHD Tweaks/YouPiP Tweaks/Return-YouTube-Dislikes Tweaks/YTABConfig Tweaks/YouMute Tweaks/DontEatMyContent Tweaks/YTHoldForSpeed Tweaks/YTVideoOverlay Tweaks/YouQuality Tweaks/YouTimeStamp Tweaks/YouGroupSettings Tweaks/YouLoop include $(THEOS_MAKE_PATH)/aggregate.mk YTLITE_PATH = Tweaks/YTLite @@ -46,6 +46,7 @@ before-package:: @cp -R Tweaks/YTVideoOverlay/layout/Library/Application\ Support/YTVideoOverlay.bundle Resources/ @cp -R Tweaks/YouQuality/layout/Library/Application\ Support/YouQuality.bundle Resources/ @cp -R Tweaks/YouTimeStamp/layout/Library/Application\ Support/YouTimeStamp.bundle Resources/ + @cp -R Tweaks/YouLoop/layout/Library/Application\ Support/YouLoop.bundle Resources/ @cp -R lang/YTLitePlus.bundle Resources/ @echo -e "==> \033[1mChanging the installation path of dylibs...\033[0m" @ldid -r .theos/obj/iSponsorBlock.dylib && install_name_tool -change /usr/lib/libcolorpicker.dylib @rpath/libcolorpicker.dylib .theos/obj/iSponsorBlock.dylib diff --git a/Tweaks/YouLoop b/Tweaks/YouLoop new file mode 160000 index 0000000..4cd5d01 --- /dev/null +++ b/Tweaks/YouLoop @@ -0,0 +1 @@ +Subproject commit 4cd5d01d3c6a1c7c1725c89208a5cc8cedad962f From 87d7b576ddf7e41d1bc733a37c6ccd63023ed12a Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 20 Aug 2024 00:53:21 +0000 Subject: [PATCH 16/18] updated submodules --- Tweaks/Return-YouTube-Dislikes | 2 +- Tweaks/YouTubeHeader | 2 +- Tweaks/protobuf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tweaks/Return-YouTube-Dislikes b/Tweaks/Return-YouTube-Dislikes index 0a223d3..8578263 160000 --- a/Tweaks/Return-YouTube-Dislikes +++ b/Tweaks/Return-YouTube-Dislikes @@ -1 +1 @@ -Subproject commit 0a223d326c3d79aef9a73085c25e125e1f9b512b +Subproject commit 8578263c9f7caf7a22bd9364648e218974ee543c diff --git a/Tweaks/YouTubeHeader b/Tweaks/YouTubeHeader index ccee5a1..850e939 160000 --- a/Tweaks/YouTubeHeader +++ b/Tweaks/YouTubeHeader @@ -1 +1 @@ -Subproject commit ccee5a1f236ad589f76e065541a8f188b0a900e8 +Subproject commit 850e939ce7053f593ed477e83ec914c98669be46 diff --git a/Tweaks/protobuf b/Tweaks/protobuf index 025909c..57ba428 160000 --- a/Tweaks/protobuf +++ b/Tweaks/protobuf @@ -1 +1 @@ -Subproject commit 025909cb539359c8001cf69707229587d430adff +Subproject commit 57ba42815efe292b3c9c99e8afadf13bbb13fff1 From bed87298f614ad8ecdb2ab6df06dc3c7e4e506f7 Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Sun, 18 Aug 2024 22:25:52 -0700 Subject: [PATCH 17/18] Update Submodule --- Tweaks/YouLoop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tweaks/YouLoop b/Tweaks/YouLoop index 4cd5d01..5a424d7 160000 --- a/Tweaks/YouLoop +++ b/Tweaks/YouLoop @@ -1 +1 @@ -Subproject commit 4cd5d01d3c6a1c7c1725c89208a5cc8cedad962f +Subproject commit 5a424d7531c0d2f82d258b8e8c580e153a93fcdd From 5066716f7f531fd1da22327bd06340498d4ac906 Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Mon, 19 Aug 2024 23:53:21 -0700 Subject: [PATCH 18/18] Localizations for Gestures --- Source/Settings.xm | 49 ++++++++++--------- .../ar.lproj/Localizable.strings | 13 +++++ .../bg.lproj/Localizable.strings | 13 +++++ .../de.lproj/Localizable.strings | 13 +++++ .../en.lproj/Localizable.strings | 13 +++++ .../es.lproj/Localizable.strings | 13 +++++ .../fr.lproj/Localizable.strings | 13 +++++ .../ja.lproj/Localizable.strings | 13 +++++ .../pt.lproj/Localizable.strings | 13 +++++ .../ro.lproj/Localizable.strings | 13 +++++ .../ru.lproj/Localizable.strings | 13 +++++ .../template.lproj/Localizable.strings | 13 +++++ .../tr.lproj/Localizable.strings | 13 +++++ .../vi.lproj/Localizable.strings | 13 +++++ .../zh_TW.lproj/Localizable.strings | 13 +++++ 15 files changed, 207 insertions(+), 24 deletions(-) diff --git a/Source/Settings.xm b/Source/Settings.xm index f45faef..8a8aaeb 100644 --- a/Source/Settings.xm +++ b/Source/Settings.xm @@ -74,7 +74,7 @@ static const NSInteger YTLiteSection = 789; %end -// Settings +// Add YTLitePlus to the settings list %hook YTAppSettingsPresentationData + (NSArray *)settingsCategoryOrder { NSArray *order = %orig; @@ -102,14 +102,15 @@ static const NSInteger YTLiteSection = 789; Class YTSettingsSectionItemClass = %c(YTSettingsSectionItem); YTSettingsViewController *settingsViewController = [self valueForKey:@"_settingsViewControllerDelegate"]; + // Add item for going to the YTLitePlus GitHub page YTSettingsSectionItem *main = [%c(YTSettingsSectionItem) - itemWithTitle:[NSString stringWithFormat:LOC(@"VERSION"), @(OS_STRINGIFY(TWEAK_VERSION))] - titleDescription:LOC(@"VERSION_CHECK") - accessibilityIdentifier:nil - detailTextBlock:nil - selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { - return [%c(YTUIUtils) openURL:[NSURL URLWithString:@"https://github.com/YTLitePlus/YTLitePlus/releases/latest"]]; - }]; + itemWithTitle:[NSString stringWithFormat:LOC(@"VERSION"), @(OS_STRINGIFY(TWEAK_VERSION))] + titleDescription:LOC(@"VERSION_CHECK") + accessibilityIdentifier:nil + detailTextBlock:nil + selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { + return [%c(YTUIUtils) openURL:[NSURL URLWithString:@"https://github.com/YTLitePlus/YTLitePlus/releases/latest"]]; + }]; [sectionItems addObject:main]; YTSettingsSectionItem *copySettings = [%c(YTSettingsSectionItem) @@ -211,13 +212,13 @@ static const NSInteger YTLiteSection = 789; static NSString* (^sectionGestureSelectedModeToString)(GestureMode) = ^(GestureMode sectionIndex) { switch (sectionIndex) { case GestureModeVolume: - return LOC(@"Volume"); + return LOC(@"VOLUME"); case GestureModeBrightness: - return LOC(@"Brightness"); + return LOC(@"BRIGHTNESS"); case GestureModeSeek: - return LOC(@"Seek"); + return LOC(@"SEEK"); case GestureModeDisabled: - return LOC(@"Disabled"); + return LOC(@"DISABLED"); default: return @"Invalid index - Report bug"; } @@ -268,8 +269,8 @@ static const NSInteger YTLiteSection = 789; [deadzoneValues addObject:@(value)]; } YTSettingsSectionItem *deadzonePicker = [YTSettingsSectionItemClass - itemWithTitle:LOC(@"Deadzone") - titleDescription:LOC(@"Minimum distance to move before a gesture is recognized") + itemWithTitle:LOC(@"DEADZONE") + titleDescription:LOC(@"DEADZONE_DESC") accessibilityIdentifier:nil detailTextBlock:^NSString *() { return [NSString stringWithFormat:@"%ld px", (long)GetFloat(@"playerGesturesDeadzone")]; @@ -296,7 +297,7 @@ static const NSInteger YTLiteSection = 789; } // Present deadzone picker when selecting this settings item YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] - initWithNavTitle:LOC(@"Deadzone") + initWithNavTitle:LOC(@"DEADZONE") pickerSectionTitle:nil rows:deadzoneRows selectedItemIndex:selectedIndex @@ -313,8 +314,8 @@ static const NSInteger YTLiteSection = 789; [sensitivityValues addObject:@(value)]; } YTSettingsSectionItem *sensitivityPicker = [YTSettingsSectionItemClass - itemWithTitle:LOC(@"Sensitivity") - titleDescription:LOC(@"Multiplier on volume and brightness gestures") + itemWithTitle:LOC(@"SENSITIVITY") + titleDescription:LOC(@"SENSITIVITY_DESC") accessibilityIdentifier:nil detailTextBlock:^NSString *() { return [NSString stringWithFormat:@"%.1f", GetFloat(@"playerGesturesSensitivity")]; @@ -341,7 +342,7 @@ static const NSInteger YTLiteSection = 789; } // Present sensitivity picker YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] - initWithNavTitle:LOC(@"Sensitivity") + initWithNavTitle:LOC(@"SENSITIVITY") pickerSectionTitle:nil rows:sensitivityRows selectedItemIndex:selectedIndex @@ -352,13 +353,13 @@ static const NSInteger YTLiteSection = 789; } ]; - // High level gestures menu - YTSettingsSectionItem *playerGesturesGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"Player Gestures (Beta)") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { + // Create and add items to the high level gestures menu + YTSettingsSectionItem *playerGesturesGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"PLAYER_GESTURES_TITLE") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { NSArray *rows = @[ // Description header item [YTSettingsSectionItemClass itemWithTitle:nil - titleDescription:LOC(@"Configure horizontal pan gestures for the player.") + titleDescription:LOC(@"PLAYER_GESTURES_DESC") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:nil @@ -366,9 +367,9 @@ static const NSInteger YTLiteSection = 789; // Toggle for enabling gestures BASIC_SWITCH(LOC(@"PLAYER_GESTURES_TOGGLE"), nil, @"playerGestures_enabled"), // Pickers for each gesture section - createSectionGestureSelector(@"Top Section", @"playerGestureTopSelection"), - createSectionGestureSelector(@"Middle Section", @"playerGestureMiddleSelection"), - createSectionGestureSelector(@"Bottom Section", @"playerGestureBottomSelection"), + createSectionGestureSelector(@"TOP_SECTION", @"playerGestureTopSelection"), + createSectionGestureSelector(@"MIDDLE_SECTION", @"playerGestureMiddleSelection"), + createSectionGestureSelector(@"BOTTOM_SECTION", @"playerGestureBottomSelection"), // Pickers for configuration settings deadzonePicker, sensitivityPicker diff --git a/lang/YTLitePlus.bundle/ar.lproj/Localizable.strings b/lang/YTLitePlus.bundle/ar.lproj/Localizable.strings index 88493c7..2820e92 100644 --- a/lang/YTLitePlus.bundle/ar.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/ar.lproj/Localizable.strings @@ -15,6 +15,19 @@ // Player Gestures "PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; +"VOLUME" = "Volume"; +"BRIGHTNESS" = "Brightness"; +"SEEK" = "Seek"; +"DISABLED" = "Disabled"; +"DEADZONE" = "Deadzone"; +"DEADZONE_DESC" = "Minimum distance to move before a gesture is recognized"; +"SENSITIVITY" = "Sensitivity"; +"SENSITIVITY_DESC" = "Multiplier on volume and brightness gestures"; +"PLAYER_GESTURES_TITLE" = "Player Gestures"; +"PLAYER_GESTURES_DESC" = "Configure horizontal pan gestures for the player"; +"TOP_SECTION" = "Top Section"; +"MIDDLE_SECTION" = "Middle Section"; +"BOTTOM_SECTION" = "Bottom Section"; // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "خيارات تراكب ضوابط الفيديو"; diff --git a/lang/YTLitePlus.bundle/bg.lproj/Localizable.strings b/lang/YTLitePlus.bundle/bg.lproj/Localizable.strings index a5dbeda..5d2c48a 100644 --- a/lang/YTLitePlus.bundle/bg.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/bg.lproj/Localizable.strings @@ -15,6 +15,19 @@ // Player Gestures "PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; +"VOLUME" = "Volume"; +"BRIGHTNESS" = "Brightness"; +"SEEK" = "Seek"; +"DISABLED" = "Disabled"; +"DEADZONE" = "Deadzone"; +"DEADZONE_DESC" = "Minimum distance to move before a gesture is recognized"; +"SENSITIVITY" = "Sensitivity"; +"SENSITIVITY_DESC" = "Multiplier on volume and brightness gestures"; +"PLAYER_GESTURES_TITLE" = "Player Gestures"; +"PLAYER_GESTURES_DESC" = "Configure horizontal pan gestures for the player"; +"TOP_SECTION" = "Top Section"; +"MIDDLE_SECTION" = "Middle Section"; +"BOTTOM_SECTION" = "Bottom Section"; // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Опции за контрол на видеото"; diff --git a/lang/YTLitePlus.bundle/de.lproj/Localizable.strings b/lang/YTLitePlus.bundle/de.lproj/Localizable.strings index 07b2ada..3671c43 100644 --- a/lang/YTLitePlus.bundle/de.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/de.lproj/Localizable.strings @@ -15,6 +15,19 @@ // Player Gestures "PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; +"VOLUME" = "Volume"; +"BRIGHTNESS" = "Brightness"; +"SEEK" = "Seek"; +"DISABLED" = "Disabled"; +"DEADZONE" = "Deadzone"; +"DEADZONE_DESC" = "Minimum distance to move before a gesture is recognized"; +"SENSITIVITY" = "Sensitivity"; +"SENSITIVITY_DESC" = "Multiplier on volume and brightness gestures"; +"PLAYER_GESTURES_TITLE" = "Player Gestures"; +"PLAYER_GESTURES_DESC" = "Configure horizontal pan gestures for the player"; +"TOP_SECTION" = "Top Section"; +"MIDDLE_SECTION" = "Middle Section"; +"BOTTOM_SECTION" = "Bottom Section"; // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Overlay-Optionen für Videosteuerungen"; diff --git a/lang/YTLitePlus.bundle/en.lproj/Localizable.strings b/lang/YTLitePlus.bundle/en.lproj/Localizable.strings index 618bcb2..80781ce 100644 --- a/lang/YTLitePlus.bundle/en.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/en.lproj/Localizable.strings @@ -15,6 +15,19 @@ // Player Gestures "PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; +"VOLUME" = "Volume"; +"BRIGHTNESS" = "Brightness"; +"SEEK" = "Seek"; +"DISABLED" = "Disabled"; +"DEADZONE" = "Deadzone"; +"DEADZONE_DESC" = "Minimum distance to move before a gesture is recognized"; +"SENSITIVITY" = "Sensitivity"; +"SENSITIVITY_DESC" = "Multiplier on volume and brightness gestures"; +"PLAYER_GESTURES_TITLE" = "Player Gestures"; +"PLAYER_GESTURES_DESC" = "Configure horizontal pan gestures for the player"; +"TOP_SECTION" = "Top Section"; +"MIDDLE_SECTION" = "Middle Section"; +"BOTTOM_SECTION" = "Bottom Section"; // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Controls Overlay Options"; diff --git a/lang/YTLitePlus.bundle/es.lproj/Localizable.strings b/lang/YTLitePlus.bundle/es.lproj/Localizable.strings index 69d06dd..8a7817b 100644 --- a/lang/YTLitePlus.bundle/es.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/es.lproj/Localizable.strings @@ -15,6 +15,19 @@ // Player Gestures "PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; +"VOLUME" = "Volume"; +"BRIGHTNESS" = "Brightness"; +"SEEK" = "Seek"; +"DISABLED" = "Disabled"; +"DEADZONE" = "Deadzone"; +"DEADZONE_DESC" = "Minimum distance to move before a gesture is recognized"; +"SENSITIVITY" = "Sensitivity"; +"SENSITIVITY_DESC" = "Multiplier on volume and brightness gestures"; +"PLAYER_GESTURES_TITLE" = "Player Gestures"; +"PLAYER_GESTURES_DESC" = "Configure horizontal pan gestures for the player"; +"TOP_SECTION" = "Top Section"; +"MIDDLE_SECTION" = "Middle Section"; +"BOTTOM_SECTION" = "Bottom Section"; // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Opciones de superposición de controles de vídeo"; diff --git a/lang/YTLitePlus.bundle/fr.lproj/Localizable.strings b/lang/YTLitePlus.bundle/fr.lproj/Localizable.strings index f5b24b8..284a08e 100644 --- a/lang/YTLitePlus.bundle/fr.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/fr.lproj/Localizable.strings @@ -15,6 +15,19 @@ // Player Gestures "PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; +"VOLUME" = "Volume"; +"BRIGHTNESS" = "Brightness"; +"SEEK" = "Seek"; +"DISABLED" = "Disabled"; +"DEADZONE" = "Deadzone"; +"DEADZONE_DESC" = "Minimum distance to move before a gesture is recognized"; +"SENSITIVITY" = "Sensitivity"; +"SENSITIVITY_DESC" = "Multiplier on volume and brightness gestures"; +"PLAYER_GESTURES_TITLE" = "Player Gestures"; +"PLAYER_GESTURES_DESC" = "Configure horizontal pan gestures for the player"; +"TOP_SECTION" = "Top Section"; +"MIDDLE_SECTION" = "Middle Section"; +"BOTTOM_SECTION" = "Bottom Section"; // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Options de l'overlay des contrôles vidéo"; diff --git a/lang/YTLitePlus.bundle/ja.lproj/Localizable.strings b/lang/YTLitePlus.bundle/ja.lproj/Localizable.strings index 5dd4f3c..931e0bf 100644 --- a/lang/YTLitePlus.bundle/ja.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/ja.lproj/Localizable.strings @@ -15,6 +15,19 @@ // Player Gestures "PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; +"VOLUME" = "Volume"; +"BRIGHTNESS" = "Brightness"; +"SEEK" = "Seek"; +"DISABLED" = "Disabled"; +"DEADZONE" = "Deadzone"; +"DEADZONE_DESC" = "Minimum distance to move before a gesture is recognized"; +"SENSITIVITY" = "Sensitivity"; +"SENSITIVITY_DESC" = "Multiplier on volume and brightness gestures"; +"PLAYER_GESTURES_TITLE" = "Player Gestures"; +"PLAYER_GESTURES_DESC" = "Configure horizontal pan gestures for the player"; +"TOP_SECTION" = "Top Section"; +"MIDDLE_SECTION" = "Middle Section"; +"BOTTOM_SECTION" = "Bottom Section"; // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "動画コントロールオーバーレイの設定"; diff --git a/lang/YTLitePlus.bundle/pt.lproj/Localizable.strings b/lang/YTLitePlus.bundle/pt.lproj/Localizable.strings index c8e734d..ff49e3a 100644 --- a/lang/YTLitePlus.bundle/pt.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/pt.lproj/Localizable.strings @@ -15,6 +15,19 @@ // Player Gestures "PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; +"VOLUME" = "Volume"; +"BRIGHTNESS" = "Brightness"; +"SEEK" = "Seek"; +"DISABLED" = "Disabled"; +"DEADZONE" = "Deadzone"; +"DEADZONE_DESC" = "Minimum distance to move before a gesture is recognized"; +"SENSITIVITY" = "Sensitivity"; +"SENSITIVITY_DESC" = "Multiplier on volume and brightness gestures"; +"PLAYER_GESTURES_TITLE" = "Player Gestures"; +"PLAYER_GESTURES_DESC" = "Configure horizontal pan gestures for the player"; +"TOP_SECTION" = "Top Section"; +"MIDDLE_SECTION" = "Middle Section"; +"BOTTOM_SECTION" = "Bottom Section"; // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Opções de Sobreposição de Controles de Vídeo"; diff --git a/lang/YTLitePlus.bundle/ro.lproj/Localizable.strings b/lang/YTLitePlus.bundle/ro.lproj/Localizable.strings index 3be083e..c11bba9 100644 --- a/lang/YTLitePlus.bundle/ro.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/ro.lproj/Localizable.strings @@ -15,6 +15,19 @@ // Player Gestures "PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; +"VOLUME" = "Volume"; +"BRIGHTNESS" = "Brightness"; +"SEEK" = "Seek"; +"DISABLED" = "Disabled"; +"DEADZONE" = "Deadzone"; +"DEADZONE_DESC" = "Minimum distance to move before a gesture is recognized"; +"SENSITIVITY" = "Sensitivity"; +"SENSITIVITY_DESC" = "Multiplier on volume and brightness gestures"; +"PLAYER_GESTURES_TITLE" = "Player Gestures"; +"PLAYER_GESTURES_DESC" = "Configure horizontal pan gestures for the player"; +"TOP_SECTION" = "Top Section"; +"MIDDLE_SECTION" = "Middle Section"; +"BOTTOM_SECTION" = "Bottom Section"; // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Opțiuni Overlay Controale Video"; diff --git a/lang/YTLitePlus.bundle/ru.lproj/Localizable.strings b/lang/YTLitePlus.bundle/ru.lproj/Localizable.strings index 0efbea6..ce1184e 100644 --- a/lang/YTLitePlus.bundle/ru.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/ru.lproj/Localizable.strings @@ -15,6 +15,19 @@ // Player Gestures "PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; +"VOLUME" = "Volume"; +"BRIGHTNESS" = "Brightness"; +"SEEK" = "Seek"; +"DISABLED" = "Disabled"; +"DEADZONE" = "Deadzone"; +"DEADZONE_DESC" = "Minimum distance to move before a gesture is recognized"; +"SENSITIVITY" = "Sensitivity"; +"SENSITIVITY_DESC" = "Multiplier on volume and brightness gestures"; +"PLAYER_GESTURES_TITLE" = "Player Gestures"; +"PLAYER_GESTURES_DESC" = "Configure horizontal pan gestures for the player"; +"TOP_SECTION" = "Top Section"; +"MIDDLE_SECTION" = "Middle Section"; +"BOTTOM_SECTION" = "Bottom Section"; // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Controls Overlay Options"; diff --git a/lang/YTLitePlus.bundle/template.lproj/Localizable.strings b/lang/YTLitePlus.bundle/template.lproj/Localizable.strings index 5efa1cd..1b60f3e 100644 --- a/lang/YTLitePlus.bundle/template.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/template.lproj/Localizable.strings @@ -30,6 +30,19 @@ https://github.com/PoomSmart/Return-YouTube-Dislikes/tree/main/layout/Library/Ap // Player Gestures "PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; +"VOLUME" = "Volume"; +"BRIGHTNESS" = "Brightness"; +"SEEK" = "Seek"; +"DISABLED" = "Disabled"; +"DEADZONE" = "Deadzone"; +"DEADZONE_DESC" = "Minimum distance to move before a gesture is recognized"; +"SENSITIVITY" = "Sensitivity"; +"SENSITIVITY_DESC" = "Multiplier on volume and brightness gestures"; +"PLAYER_GESTURES_TITLE" = "Player Gestures"; +"PLAYER_GESTURES_DESC" = "Configure horizontal pan gestures for the player"; +"TOP_SECTION" = "Top Section"; +"MIDDLE_SECTION" = "Middle Section"; +"BOTTOM_SECTION" = "Bottom Section"; // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Controls Overlay Options"; diff --git a/lang/YTLitePlus.bundle/tr.lproj/Localizable.strings b/lang/YTLitePlus.bundle/tr.lproj/Localizable.strings index 815d24a..f7c8b9f 100644 --- a/lang/YTLitePlus.bundle/tr.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/tr.lproj/Localizable.strings @@ -15,6 +15,19 @@ // Player Gestures "PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; +"VOLUME" = "Volume"; +"BRIGHTNESS" = "Brightness"; +"SEEK" = "Seek"; +"DISABLED" = "Disabled"; +"DEADZONE" = "Deadzone"; +"DEADZONE_DESC" = "Minimum distance to move before a gesture is recognized"; +"SENSITIVITY" = "Sensitivity"; +"SENSITIVITY_DESC" = "Multiplier on volume and brightness gestures"; +"PLAYER_GESTURES_TITLE" = "Player Gestures"; +"PLAYER_GESTURES_DESC" = "Configure horizontal pan gestures for the player"; +"TOP_SECTION" = "Top Section"; +"MIDDLE_SECTION" = "Middle Section"; +"BOTTOM_SECTION" = "Bottom Section"; // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Kontrol Seç."; diff --git a/lang/YTLitePlus.bundle/vi.lproj/Localizable.strings b/lang/YTLitePlus.bundle/vi.lproj/Localizable.strings index af9750c..5094da9 100644 --- a/lang/YTLitePlus.bundle/vi.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/vi.lproj/Localizable.strings @@ -15,6 +15,19 @@ // Player Gestures "PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; +"VOLUME" = "Volume"; +"BRIGHTNESS" = "Brightness"; +"SEEK" = "Seek"; +"DISABLED" = "Disabled"; +"DEADZONE" = "Deadzone"; +"DEADZONE_DESC" = "Minimum distance to move before a gesture is recognized"; +"SENSITIVITY" = "Sensitivity"; +"SENSITIVITY_DESC" = "Multiplier on volume and brightness gestures"; +"PLAYER_GESTURES_TITLE" = "Player Gestures"; +"PLAYER_GESTURES_DESC" = "Configure horizontal pan gestures for the player"; +"TOP_SECTION" = "Top Section"; +"MIDDLE_SECTION" = "Middle Section"; +"BOTTOM_SECTION" = "Bottom Section"; // Video player options "VIDEO_PLAYER_OPTIONS" = "Tùy chọn trình phát video"; diff --git a/lang/YTLitePlus.bundle/zh_TW.lproj/Localizable.strings b/lang/YTLitePlus.bundle/zh_TW.lproj/Localizable.strings index 47ef9c2..08796a9 100644 --- a/lang/YTLitePlus.bundle/zh_TW.lproj/Localizable.strings +++ b/lang/YTLitePlus.bundle/zh_TW.lproj/Localizable.strings @@ -16,6 +16,19 @@ // Player Gestures "PLAYER_GESTURES_TOGGLE" = "Enable Player Gestures"; +"VOLUME" = "Volume"; +"BRIGHTNESS" = "Brightness"; +"SEEK" = "Seek"; +"DISABLED" = "Disabled"; +"DEADZONE" = "Deadzone"; +"DEADZONE_DESC" = "Minimum distance to move before a gesture is recognized"; +"SENSITIVITY" = "Sensitivity"; +"SENSITIVITY_DESC" = "Multiplier on volume and brightness gestures"; +"PLAYER_GESTURES_TITLE" = "Player Gestures"; +"PLAYER_GESTURES_DESC" = "Configure horizontal pan gestures for the player"; +"TOP_SECTION" = "Top Section"; +"MIDDLE_SECTION" = "Middle Section"; +"BOTTOM_SECTION" = "Bottom Section"; // Video controls overlay options "VIDEO_CONTROLS_OVERLAY_OPTIONS" = "影片區覆蓋按鈕設定";