mirror of
				https://github.com/SoPat712/YTLitePlus.git
				synced 2025-10-29 20:20:41 -04:00 
			
		
		
		
	Add disable option
This commit is contained in:
		| @@ -216,6 +216,8 @@ static const NSInteger YTLiteSection = 789; | |||||||
|                 return LOC(@"Brightness"); |                 return LOC(@"Brightness"); | ||||||
|             case GestureModeSeek: |             case GestureModeSeek: | ||||||
|                 return LOC(@"Seek"); |                 return LOC(@"Seek"); | ||||||
|  |             case GestureModeDisabled: | ||||||
|  |                 return LOC(@"Disabled"); | ||||||
|             default: |             default: | ||||||
|                 return @"Invalid index - Report bug"; |                 return @"Invalid index - Report bug"; | ||||||
|         } |         } | ||||||
| @@ -242,9 +244,10 @@ static const NSInteger YTLiteSection = 789; | |||||||
|             } |             } | ||||||
|             selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { |             selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { | ||||||
|                 NSArray <YTSettingsSectionItem *> *rows = @[ |                 NSArray <YTSettingsSectionItem *> *rows = @[ | ||||||
|                     gestureCheckmarkSettingItem(0, sectionKey),                                        |                     gestureCheckmarkSettingItem(0, sectionKey), // Volume                              | ||||||
|                     gestureCheckmarkSettingItem(1, sectionKey), |                     gestureCheckmarkSettingItem(1, sectionKey), // Brightness | ||||||
|                     gestureCheckmarkSettingItem(2, sectionKey) |                     gestureCheckmarkSettingItem(2, sectionKey), // Seek | ||||||
|  |                     gestureCheckmarkSettingItem(3, sectionKey)  // Disabled | ||||||
|                 ]; |                 ]; | ||||||
|                 // Present picker when selecting this settings item |                 // Present picker when selecting this settings item | ||||||
|                 YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc]  |                 YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc]  | ||||||
| @@ -303,7 +306,6 @@ static const NSInteger YTLiteSection = 789; | |||||||
|             return YES; |             return YES; | ||||||
|         } |         } | ||||||
|     ]; |     ]; | ||||||
|     [sectionItems addObject:deadzonePicker]; |  | ||||||
|  |  | ||||||
|     // Configuration picker for sensitivity to pick from 0.5 to 2.0 with interval of 0.1 |     // Configuration picker for sensitivity to pick from 0.5 to 2.0 with interval of 0.1 | ||||||
|     NSMutableArray<NSNumber *> *sensitivityValues = [NSMutableArray array]; |     NSMutableArray<NSNumber *> *sensitivityValues = [NSMutableArray array]; | ||||||
| @@ -349,7 +351,6 @@ static const NSInteger YTLiteSection = 789; | |||||||
|             return YES; |             return YES; | ||||||
|         } |         } | ||||||
|     ]; |     ]; | ||||||
|     [sectionItems addObject:sensitivityPicker]; |  | ||||||
|  |  | ||||||
|     // High level gestures menu |     // High level gestures menu | ||||||
|     YTSettingsSectionItem *playerGesturesGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"Player Gestures (Beta)") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { |     YTSettingsSectionItem *playerGesturesGroup = [YTSettingsSectionItemClass itemWithTitle:LOC(@"Player Gestures (Beta)") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { | ||||||
|   | |||||||
| @@ -66,7 +66,7 @@ typedef NS_ENUM(NSUInteger, GestureMode) { | |||||||
|     GestureModeVolume, |     GestureModeVolume, | ||||||
|     GestureModeBrightness, |     GestureModeBrightness, | ||||||
|     GestureModeSeek, |     GestureModeSeek, | ||||||
|     GestureModeInvalid |     GestureModeDisabled | ||||||
| }; | }; | ||||||
| // Gesture Section Enum | // Gesture Section Enum | ||||||
| typedef NS_ENUM(NSUInteger, GestureSection) { | typedef NS_ENUM(NSUInteger, GestureSection) { | ||||||
|   | |||||||
| @@ -735,7 +735,11 @@ BOOL isTabSelected = NO; | |||||||
|             case GestureModeSeek: |             case GestureModeSeek: | ||||||
|                 adjustSeek(translationX, currentTime); |                 adjustSeek(translationX, currentTime); | ||||||
|                 break; |                 break; | ||||||
|  |             case GestureModeDisabled: | ||||||
|  |                 // Do nothing if the gesture is disabled | ||||||
|  |                 break; | ||||||
|             default: |             default: | ||||||
|  |                 // Show an alert if the gesture mode is invalid | ||||||
|                 UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Invalid Gesture Mode" message:@"Please report this bug." preferredStyle:UIAlertControllerStyleAlert]; |                 UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Invalid Gesture Mode" message:@"Please report this bug." preferredStyle:UIAlertControllerStyleAlert]; | ||||||
|                 UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; |                 UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]; | ||||||
|                 [alertController addAction:okAction]; |                 [alertController addAction:okAction]; | ||||||
| @@ -755,10 +759,27 @@ BOOL isTabSelected = NO; | |||||||
|         // by dividing the view into thirds |         // by dividing the view into thirds | ||||||
|         if (startLocation.y <= viewHeight / 3.0) { |         if (startLocation.y <= viewHeight / 3.0) { | ||||||
|             gestureSection = GestureSectionTop; |             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) { |         } else if (startLocation.y <= 2 * viewHeight / 3.0) { | ||||||
|             gestureSection = GestureSectionMiddle; |             gestureSection = GestureSectionMiddle; | ||||||
|  |             // Cancel the gesture if the mode is disabled | ||||||
|  |             if (GetSelection(@"playerGestureMiddleSelection") == GestureModeDisabled) { | ||||||
|  |                 panGestureRecognizer.state = UIGestureRecognizerStateCancelled; | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|         } else if (startLocation.y <= viewHeight) { |         } else if (startLocation.y <= viewHeight) { | ||||||
|             gestureSection = GestureSectionBottom; |             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 |         // Deactive the activity flag | ||||||
|         isValidHorizontalPan = NO; |         isValidHorizontalPan = NO; | ||||||
| @@ -803,6 +824,9 @@ BOOL isTabSelected = NO; | |||||||
|                 runSelectedGesture(@"playerGestureMiddleSelection", adjustedTranslationX, initialBrightness, initialVolume, currentTime); |                 runSelectedGesture(@"playerGestureMiddleSelection", adjustedTranslationX, initialBrightness, initialVolume, currentTime); | ||||||
|             } else if (gestureSection == GestureSectionBottom) { |             } else if (gestureSection == GestureSectionBottom) { | ||||||
|                 runSelectedGesture(@"playerGestureBottomSelection", adjustedTranslationX, initialBrightness, initialVolume, currentTime); |                 runSelectedGesture(@"playerGestureBottomSelection", adjustedTranslationX, initialBrightness, initialVolume, currentTime); | ||||||
|  |             } else { | ||||||
|  |                 // If the section is invalid, cancel the gesture | ||||||
|  |                 panGestureRecognizer.state = UIGestureRecognizerStateCancelled; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Bryce Hackel
					Bryce Hackel