diff --git a/Sources/RootOptionsController.m b/Sources/RootOptionsController.m index d62533a..436a6a8 100644 --- a/Sources/RootOptionsController.m +++ b/Sources/RootOptionsController.m @@ -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]; }