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];
}
// Show a toast message to confirm the action
[[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:@"Settings pasted"]];
// Reminder to import YouTube Plus settings
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];
[reminderAlert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
[settingsViewController presentViewController:reminderAlert animated:YES completion:nil];
@@ -678,7 +676,7 @@ static const NSInteger YTLiteSection = 789;
NSError *error;
NSString *fileType = [pickedURL resourceValuesForKeys:@[NSURLTypeIdentifierKey] error:&error][NSURLTypeIdentifierKey];
UIViewController *settingsViewController = [self valueForKey:@"_settingsViewControllerDelegate"];
YTSettingsViewController *settingsViewController = [self valueForKey:@"_settingsViewControllerDelegate"];
if (UTTypeConformsTo((__bridge CFStringRef)fileType, kUTTypePlainText)) {
// 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];
}
}
if ([settingsViewController respondsToSelector:@selector(reloadData)]) {
// Call a custom reloadData method if it exists
[settingsViewController performSelector:@selector(reloadData)];
}
[settingsViewController reloadData];
// Show a toast message to confirm the action
[[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:@"Settings applied"]];
}
}
}

View File

@@ -17,8 +17,9 @@ NSArray *NSUserDefaultsCopyKeys = @[
@"hideHomeTab_enabled", @"hidePreviewCommentSection_enabled", @"hideRightPanel_enabled",
@"hideSpeedToast_enabled", @"hideSponsorBlockButton_enabled", @"hideVideoPlayerShadowOverlayButtons_enabled",
@"iPadLayout_enabled", @"iPhoneLayout_enabled", @"inline_muted_playback_enabled", @"lowContrastMode_enabled",
@"newSettingsUI_enabled", @"oledKeyBoard_enabled", @"playerGestures_enabled", @"seekAnywhere_enabled",
@"switchCopyandPasteFunctionality_enabled", @"ytNoModernUI_enabled", @"ytStartupAnimation_enabled",
@"newSettingsUI_enabled", @"oledKeyBoard_enabled", @"playerGesturesHapticFeedback_enabled",
@"playerGestures_enabled", @"seekAnywhere_enabled", @"switchCopyandPasteFunctionality_enabled",
@"videoPlayerButton_enabled", @"ytNoModernUI_enabled", @"ytStartupAnimation_enabled",
// DEMC - https://github.com/therealFoxster/DontEatMyContent/blob/master/Tweak.h
@"DEMC_enabled", @"DEMC_colorViewsEnabled", @"DEMC_safeAreaConstant", @"DEMC_disableAmbientMode",
@"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
that match the pattern @\"<some_text>_enabled\". The matching keys are then printed
with indentation and line breaks if the line exceeds 120 characters.
Ignores SettingsKeys.h
Usage:
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 file in files:
if file.endswith(('.xm', '.h')):
# Skip SettingsKeys.h
if file == "SettingsKeys.h":
continue
file_path = os.path.join(root, file)
found_keys.update(extract_values_from_file(file_path))