Skip to content

Commit

Permalink
Added Paste Settings Button (Settings.xm)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
arichornlover authored May 10, 2024
1 parent fc22019 commit f14e068
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Sources/uYouPlusSettings.xm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f14e068

Please sign in to comment.