Add setting for haptic feedback

This commit is contained in:
Bryce Hackel
2024-08-26 00:06:39 -07:00
parent 268568b106
commit 573c2d2f43
16 changed files with 24 additions and 3 deletions

View File

@@ -397,7 +397,9 @@ static const NSInteger YTLiteSection = 789;
createSectionGestureSelector(@"BOTTOM_SECTION", @"playerGestureBottomSelection"),
// Pickers for configuration settings
deadzonePicker,
sensitivityPicker
sensitivityPicker,
// Toggle for haptic feedback
BASIC_SWITCH(LOC(@"PLAYER_GESTURES_HAPTIC_FEEDBACK"), nil, @"playerGesturesHapticFeedback_enabled"),
];
YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"Player Gestures (Beta)") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]];
[settingsViewController pushViewController:picker];

View File

@@ -909,8 +909,10 @@ BOOL isTabSelected = NO;
break;
}
// Provide haptic feedback to indicate a gesture start
[feedbackGenerator prepare];
[feedbackGenerator impactOccurred];
if (IS_ENABLED(@"playerGesturesHapticFeedback_enabled")) {
[feedbackGenerator prepare];
[feedbackGenerator impactOccurred];
}
} else {
// Cancel the gesture if the translation is not horizontal
panGestureRecognizer.state = UIGestureRecognizerStateCancelled;
@@ -1230,4 +1232,7 @@ BOOL isTabSelected = NO;
if (![allKeys containsObject:@"playerGesturesSensitivity"]) {
[[NSUserDefaults standardUserDefaults] setFloat:1.0 forKey:@"playerGesturesSensitivity"];
}
if (![allKeys containsObject:@"playerGesturesHapticFeedback_enabled"]) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"playerGesturesHapticFeedback_enabled"];
}
}

View File

@@ -31,6 +31,7 @@
"TOP_SECTION" = "Top Section";
"MIDDLE_SECTION" = "Middle Section";
"BOTTOM_SECTION" = "Bottom Section";
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
// Video controls overlay options
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "خيارات تراكب ضوابط الفيديو";

View File

@@ -31,6 +31,7 @@
"TOP_SECTION" = "Top Section";
"MIDDLE_SECTION" = "Middle Section";
"BOTTOM_SECTION" = "Bottom Section";
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
// Video controls overlay options
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Опции за контрол на видеото";

View File

@@ -31,6 +31,7 @@
"TOP_SECTION" = "Top Section";
"MIDDLE_SECTION" = "Middle Section";
"BOTTOM_SECTION" = "Bottom Section";
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
// Video controls overlay options
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Overlay-Optionen für Videosteuerungen";

View File

@@ -31,6 +31,7 @@
"TOP_SECTION" = "Top Section";
"MIDDLE_SECTION" = "Middle Section";
"BOTTOM_SECTION" = "Bottom Section";
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
// Video controls overlay options
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Controls Overlay Options";

View File

@@ -31,6 +31,7 @@
"TOP_SECTION" = "Top Section";
"MIDDLE_SECTION" = "Middle Section";
"BOTTOM_SECTION" = "Bottom Section";
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
// Video controls overlay options
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Opciones de superposición de controles de vídeo";

View File

@@ -31,6 +31,7 @@
"TOP_SECTION" = "Top Section";
"MIDDLE_SECTION" = "Middle Section";
"BOTTOM_SECTION" = "Bottom Section";
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
// Video controls overlay options
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Options de l'overlay des contrôles vidéo";

View File

@@ -31,6 +31,7 @@
"TOP_SECTION" = "Top Section";
"MIDDLE_SECTION" = "Middle Section";
"BOTTOM_SECTION" = "Bottom Section";
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
// Video controls overlay options
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "動画コントロールオーバーレイの設定";

View File

@@ -31,6 +31,7 @@
"TOP_SECTION" = "Top Section";
"MIDDLE_SECTION" = "Middle Section";
"BOTTOM_SECTION" = "Bottom Section";
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
// Video controls overlay options
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Opções de Sobreposição de Controles de Vídeo";

View File

@@ -31,6 +31,7 @@
"TOP_SECTION" = "Top Section";
"MIDDLE_SECTION" = "Middle Section";
"BOTTOM_SECTION" = "Bottom Section";
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
// Video controls overlay options
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Opțiuni Overlay Controale Video";

View File

@@ -31,6 +31,7 @@
"TOP_SECTION" = "Top Section";
"MIDDLE_SECTION" = "Middle Section";
"BOTTOM_SECTION" = "Bottom Section";
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
// Video controls overlay options
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Controls Overlay Options";

View File

@@ -46,6 +46,7 @@ https://github.com/PoomSmart/Return-YouTube-Dislikes/tree/main/layout/Library/Ap
"TOP_SECTION" = "Top Section";
"MIDDLE_SECTION" = "Middle Section";
"BOTTOM_SECTION" = "Bottom Section";
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
// Video controls overlay options
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Controls Overlay Options";

View File

@@ -31,6 +31,7 @@
"TOP_SECTION" = "Top Section";
"MIDDLE_SECTION" = "Middle Section";
"BOTTOM_SECTION" = "Bottom Section";
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
// Video controls overlay options
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "Video Kontrol Seç.";

View File

@@ -31,6 +31,7 @@
"TOP_SECTION" = "Top Section";
"MIDDLE_SECTION" = "Middle Section";
"BOTTOM_SECTION" = "Bottom Section";
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
// Video player options
"VIDEO_PLAYER_OPTIONS" = "Tùy chọn trình phát video";

View File

@@ -32,6 +32,7 @@
"TOP_SECTION" = "Top Section";
"MIDDLE_SECTION" = "Middle Section";
"BOTTOM_SECTION" = "Bottom Section";
"PLAYER_GESTURES_HAPTIC_FEEDBACK" = "Enable Haptic Feedback";
// Video controls overlay options
"VIDEO_CONTROLS_OVERLAY_OPTIONS" = "影片區覆蓋按鈕設定";