Add keys, fix toasts

This commit is contained in:
Bryce Hackel
2024-08-26 01:46:52 -07:00
parent 5095267b4c
commit 6996c0ed66
3 changed files with 12 additions and 10 deletions

View File

@@ -191,11 +191,9 @@ static const NSInteger YTLiteSection = 789;
}]]; }]];
[settingsViewController presentViewController:confirmPasteAlert animated:YES completion:nil]; [settingsViewController presentViewController:confirmPasteAlert animated:YES completion:nil];
} }
// Show a toast message to confirm the action
[[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:@"Settings pasted"]];
// Reminder to import YouTube Plus settings // Reminder to import YouTube Plus settings
UIAlertController *reminderAlert = [UIAlertController alertControllerWithTitle:@"Reminder" UIAlertController *reminderAlert = [UIAlertController alertControllerWithTitle:@"Reminder"
message:@"Remember to import your YouTube Plus settings as well." message:@"Remember to import your YouTube Plus settings as well"
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
[reminderAlert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]]; [reminderAlert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
[settingsViewController presentViewController:reminderAlert animated:YES completion:nil]; [settingsViewController presentViewController:reminderAlert animated:YES completion:nil];
@@ -678,7 +676,7 @@ static const NSInteger YTLiteSection = 789;
NSError *error; NSError *error;
NSString *fileType = [pickedURL resourceValuesForKeys:@[NSURLTypeIdentifierKey] error:&error][NSURLTypeIdentifierKey]; NSString *fileType = [pickedURL resourceValuesForKeys:@[NSURLTypeIdentifierKey] error:&error][NSURLTypeIdentifierKey];
UIViewController *settingsViewController = [self valueForKey:@"_settingsViewControllerDelegate"]; YTSettingsViewController *settingsViewController = [self valueForKey:@"_settingsViewControllerDelegate"];
if (UTTypeConformsTo((__bridge CFStringRef)fileType, kUTTypePlainText)) { if (UTTypeConformsTo((__bridge CFStringRef)fileType, kUTTypePlainText)) {
// This block handles the import of settings from a text file. // This block handles the import of settings from a text file.
@@ -692,10 +690,9 @@ static const NSInteger YTLiteSection = 789;
[[NSUserDefaults standardUserDefaults] setObject:value forKey:key]; [[NSUserDefaults standardUserDefaults] setObject:value forKey:key];
} }
} }
if ([settingsViewController respondsToSelector:@selector(reloadData)]) { [settingsViewController reloadData];
// Call a custom reloadData method if it exists // Show a toast message to confirm the action
[settingsViewController performSelector:@selector(reloadData)]; [[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:@"Settings applied"]];
}
} }
} }
} }

View File

@@ -17,8 +17,9 @@ NSArray *NSUserDefaultsCopyKeys = @[
@"hideHomeTab_enabled", @"hidePreviewCommentSection_enabled", @"hideRightPanel_enabled", @"hideHomeTab_enabled", @"hidePreviewCommentSection_enabled", @"hideRightPanel_enabled",
@"hideSpeedToast_enabled", @"hideSponsorBlockButton_enabled", @"hideVideoPlayerShadowOverlayButtons_enabled", @"hideSpeedToast_enabled", @"hideSponsorBlockButton_enabled", @"hideVideoPlayerShadowOverlayButtons_enabled",
@"iPadLayout_enabled", @"iPhoneLayout_enabled", @"inline_muted_playback_enabled", @"lowContrastMode_enabled", @"iPadLayout_enabled", @"iPhoneLayout_enabled", @"inline_muted_playback_enabled", @"lowContrastMode_enabled",
@"newSettingsUI_enabled", @"oledKeyBoard_enabled", @"playerGestures_enabled", @"seekAnywhere_enabled", @"newSettingsUI_enabled", @"oledKeyBoard_enabled", @"playerGesturesHapticFeedback_enabled",
@"switchCopyandPasteFunctionality_enabled", @"ytNoModernUI_enabled", @"ytStartupAnimation_enabled", @"playerGestures_enabled", @"seekAnywhere_enabled", @"switchCopyandPasteFunctionality_enabled",
@"videoPlayerButton_enabled", @"ytNoModernUI_enabled", @"ytStartupAnimation_enabled",
// DEMC - https://github.com/therealFoxster/DontEatMyContent/blob/master/Tweak.h // DEMC - https://github.com/therealFoxster/DontEatMyContent/blob/master/Tweak.h
@"DEMC_enabled", @"DEMC_colorViewsEnabled", @"DEMC_safeAreaConstant", @"DEMC_disableAmbientMode", @"DEMC_enabled", @"DEMC_colorViewsEnabled", @"DEMC_safeAreaConstant", @"DEMC_disableAmbientMode",
@"DEMC_limitZoomToFill", @"DEMC_enableForAllVideos", @"DEMC_limitZoomToFill", @"DEMC_enableForAllVideos",

View File

@@ -61,6 +61,7 @@ def find_and_extract_keys():
Recursively searches for .xm and .h files in the parent directory and extracts keys Recursively searches for .xm and .h files in the parent directory and extracts keys
that match the pattern @\"<some_text>_enabled\". The matching keys are then printed that match the pattern @\"<some_text>_enabled\". The matching keys are then printed
with indentation and line breaks if the line exceeds 120 characters. with indentation and line breaks if the line exceeds 120 characters.
Ignores SettingsKeys.h
Usage: Usage:
1. Place this script in the desired directory. 1. Place this script in the desired directory.
@@ -82,6 +83,9 @@ def find_and_extract_keys():
for root, dirs, files in os.walk(parent_directory): for root, dirs, files in os.walk(parent_directory):
for file in files: for file in files:
if file.endswith(('.xm', '.h')): if file.endswith(('.xm', '.h')):
# Skip SettingsKeys.h
if file == "SettingsKeys.h":
continue
file_path = os.path.join(root, file) file_path = os.path.join(root, file)
found_keys.update(extract_values_from_file(file_path)) found_keys.update(extract_values_from_file(file_path))