Add “App Icon” Button - RootOptionsController.m

This commit is contained in:
arichornlover 2024-04-04 20:47:06 -05:00 committed by GitHub
parent 11ad0ea7f7
commit f7b8af3efe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,7 @@
#import "RootOptionsController.h"
#import "ColourOptionsController.h"
#import "ColourOptionsController2.h"
#import "AppIconOptionsController.h"
@interface RootOptionsController ()
@end
@ -14,6 +15,9 @@
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done)];
self.navigationItem.leftBarButtonItem = doneButton;
UIBarButtonItem *appIconButton = [[UIBarButtonItem alloc] initWithTitle:@"App Icon" style:UIBarButtonItemStylePlain target:self action:@selector(showAppIconOptions)];
self.navigationItem.rightBarButtonItem = appIconButton;
UITableViewStyle style;
if (@available(iOS 13, *)) {
@ -164,6 +168,19 @@
@implementation RootOptionsController (Privates)
- (void)showAppIconOptions {
if (@available(iOS 15.0, *)) {
AppIconOptionsController *appIconOptionsController = [[AppIconOptionsController alloc] init];
UINavigationController *appIconOptionsNavController = [[UINavigationController alloc] initWithRootViewController:appIconOptionsController];
[self presentViewController:appIconOptionsNavController animated:YES completion:nil];
} else {
NSString *systemVersion = [[UIDevice currentDevice] systemVersion];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Incompatible" message:[NSString stringWithFormat:@"Changing app icons is only available on iOS 15 and later.\nYour Device is currently using iOS %@.", systemVersion] preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
[self presentViewController:alert animated:YES completion:nil];
}
}
- (void)done {
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}