mirror of
https://github.com/SoPat712/YTLitePlus.git
synced 2025-08-21 18:48:45 -04:00
Gesture test using YTHFS code
This commit is contained in:
@@ -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];
|
||||
|
@@ -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];
|
||||
|
Reference in New Issue
Block a user