Fix defaults and text descriptions

This commit is contained in:
Bryce Hackel
2024-08-16 01:13:22 -07:00
parent e21e026c30
commit e63bc374cf
16 changed files with 100 additions and 31 deletions

View File

@@ -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<NSNumber *> *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 <YTSettingsSectionItem *> *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<NSNumber *> *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 <YTSettingsSectionItem *> *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 <YTSettingsSectionItem *> *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];

View File

@@ -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"];
}
}

View File

@@ -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" = "خيارات تراكب ضوابط الفيديو";

View File

@@ -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" = "Опции за контрол на видеото";

View File

@@ -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";

View File

@@ -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";

View File

@@ -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";

View File

@@ -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";

View File

@@ -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" = "動画コントロールオーバーレイの設定";

View File

@@ -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";

View File

@@ -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";

View File

@@ -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";

View File

@@ -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";

View File

@@ -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ç.";

View File

@@ -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";

View File

@@ -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" = "影片區覆蓋按鈕設定";