Update ColourOptionsController.m

Remove YouTube Reborn Stuff
This commit is contained in:
arichornlover 2024-01-11 17:58:32 -06:00 committed by GitHub
parent dea08c68ba
commit f0b7efb509
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,4 @@
#import "ColourOptionsController.h"
#import "Localization.h"
@interface ColourOptionsController ()
- (void)coloursView;
@ -11,16 +10,19 @@
[super loadView];
[self coloursView];
self.title = LOC(@"COLOR_OPTIONS");
self.title = LOC(@"Theme Custom Color");
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done)];
self.navigationItem.leftBarButtonItem = doneButton;
UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStylePlain target:self action:@selector(close)];
self.navigationItem.rightBarButtonItem = closeButton;
UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStylePlain target:self action:@selector(save)];
self.navigationItem.rightBarButtonItem = saveButton;
UIBarButtonItem *resetButton = [[UIBarButtonItem alloc] initWithTitle:@"Reset" style:UIBarButtonItemStylePlain target:self action:@selector(reset)];
self.navigationItem.leftBarButtonItem = resetButton;
self.supportsAlpha = NO;
NSData *colorData = [[NSUserDefaults standardUserDefaults] objectForKey:@"kYTRebornColourOptionsVFour"];
NSData *colorData = [[NSUserDefaults standardUserDefaults] objectForKey:@"kCustomThemeColor"];
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:colorData error:nil];
[unarchiver setRequiresSecureCoding:NO];
UIColor *color = [unarchiver decodeObjectForKey:NSKeyedArchiveRootObjectKey];
@ -49,16 +51,16 @@
@implementation ColourOptionsController(Privates)
- (void)done {
- (void)close {
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}
- (void)save {
NSData *colorData = [NSKeyedArchiver archivedDataWithRootObject:self.selectedColor requiringSecureCoding:nil error:nil];
[[NSUserDefaults standardUserDefaults] setObject:colorData forKey:@"kYTRebornColourOptionsVFour"];
[[NSUserDefaults standardUserDefaults] setObject:colorData forKey:@"kCustomThemeColor"];
[[NSUserDefaults standardUserDefaults] synchronize];
UIAlertController *alertSaved = [UIAlertController alertControllerWithTitle:@"Colour Saved" message:nil preferredStyle:UIAlertControllerStyleAlert];
UIAlertController *alertSaved = [UIAlertController alertControllerWithTitle:@"Color Saved" message:nil preferredStyle:UIAlertControllerStyleAlert];
[alertSaved addAction:[UIAlertAction actionWithTitle:@"Okay" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
}]];
@ -66,4 +68,9 @@
[self presentViewController:alertSaved animated:YES completion:nil];
}
- (void)reset {
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"kCustomThemeColor"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
@end