Added Paste Settings Button (Settings.xm)

what it does: “Paste Settings” is a new button in uYouEnhanced settings that can allow you to paste option keys (k)
Example (Clipboard): 
key: 0
key: 1

key is something like a key that shows `_enabled` so basically `lowContrastMode_enabled` can be used.

next the numbers indicate rather they are off or on.
0 = Off/Disabled
1 = On/Enabled
for the option.
This commit is contained in:
arichornlover 2024-05-09 23:10:18 -05:00 committed by GitHub
parent fc22019286
commit f14e068347
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -180,6 +180,33 @@ extern NSBundle *uYouPlusBundle();
];
[sectionItems addObject:developers];
YTSettingsSectionItem *pasteSettings = [%c(YTSettingsSectionItem)
itemWithTitle:LOC(@"Paste Settings")
titleDescription:LOC(@"Paste settings from clipboard and apply")
accessibilityIdentifier:nil
detailTextBlock:nil
selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) {
NSString *settingsString = [[UIPasteboard generalPasteboard] string];
if (settingsString.length > 0) {
NSArray *lines = [settingsString componentsSeparatedByString:@"\n"];
for (NSString *line in lines) {
NSArray *components = [line componentsSeparatedByString:@": "];
if (components.count == 2) {
NSString *key = components[0];
BOOL value = [components[1] intValue];
[[NSUserDefaults standardUserDefaults] setBool:value forKey:key];
}
}
}
[settingsViewController reloadData];
SHOW_RELAUNCH_YT_SNACKBAR;
return YES;
}
];
[sectionItems addObject:pasteSettings];
YTSettingsSectionItem *exitYT = [%c(YTSettingsSectionItem)
itemWithTitle:LOC(@"QUIT_YOUTUBE")
titleDescription:nil