From cf5a0d7bff6493295f88d1738f1fce66e3469d8a Mon Sep 17 00:00:00 2001 From: mac-user669 Date: Sat, 25 Jan 2020 19:38:31 -0500 Subject: [PATCH] Prefs designing! I really need to look into a color picker now... --- zenithdarkprefs/Resources/Root.plist | 4 +- .../ZNDarkPrefsRootListController.h | 22 ---------- .../ZNDarkPrefsRootListController.m | 40 +++++++------------ 3 files changed, 17 insertions(+), 49 deletions(-) diff --git a/zenithdarkprefs/Resources/Root.plist b/zenithdarkprefs/Resources/Root.plist index c818d1a..d09febf 100644 --- a/zenithdarkprefs/Resources/Root.plist +++ b/zenithdarkprefs/Resources/Root.plist @@ -49,7 +49,7 @@ cellClass HBTintedTableCell action - doAFancyRespring + respringPopUp cell @@ -72,6 +72,6 @@ title - ZenithDark + diff --git a/zenithdarkprefs/ZNDarkPrefsRootListController.h b/zenithdarkprefs/ZNDarkPrefsRootListController.h index eb26f31..fd4cf6d 100644 --- a/zenithdarkprefs/ZNDarkPrefsRootListController.h +++ b/zenithdarkprefs/ZNDarkPrefsRootListController.h @@ -14,25 +14,3 @@ @property (nonatomic, strong) UIVisualEffectView *respringEffectView; @property (nonatomic, strong) UIWindow *mainAppRootWindow; @end - -// we use this to respring our device! -@interface NSTask : NSObject -@property (copy) NSArray *arguments; -@property (copy) NSString *currentDirectoryPath; -@property (copy) NSDictionary *environment; -@property (copy) NSString *launchPath; -@property (readonly) int processIdentifier; -@property (retain) id standardError; -@property (retain) id standardInput; -@property (retain) id standardOutput; -+ (id)currentTaskDictionary; -+ (id)launchedTaskWithDictionary:(id)arg1; -+ (id)launchedTaskWithLaunchPath:(id)arg1 arguments:(id)arg2; -- (id)init; -- (void)interrupt; -- (bool)isRunning; -- (void)launch; -- (bool)resume; -- (bool)suspend; -- (void)terminate; -@end diff --git a/zenithdarkprefs/ZNDarkPrefsRootListController.m b/zenithdarkprefs/ZNDarkPrefsRootListController.m index e5edc58..1258da8 100644 --- a/zenithdarkprefs/ZNDarkPrefsRootListController.m +++ b/zenithdarkprefs/ZNDarkPrefsRootListController.m @@ -1,5 +1,7 @@ #import "ZNDarkPrefsRootListController.h" #import +#import +#import #define THEME_COLOR \ [UIColor colorWithRed:0.82 \ @@ -44,6 +46,7 @@ } // End of "Hide Large Title" + //share button action - (void)shareTapped { @@ -77,40 +80,27 @@ return _specifiers; } --(void)respring { - NSTask *task = [[[NSTask alloc] init] autorelease]; - [task setLaunchPath:@"/usr/bin/killall"]; - [task setArguments:[NSArray arrayWithObjects:@"backboardd", nil]]; - [task launch]; - +- (void)respring { + [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil]; // Dismisses keyboard + [HBRespringController respringAndReturnTo:[NSURL URLWithString:@"prefs:root=ZenithDark"]]; } --(void)doAFancyRespring { +-(void)respringPopUp { - UIAlertController *confirmRespringAlert = [UIAlertController alertControllerWithTitle:@"Apply Settings?" message:@"This will respring your device." preferredStyle:UIAlertControllerStyleActionSheet]; - UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"Respring" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { + UIAlertController *confirmRespringAlert = [UIAlertController alertControllerWithTitle:@"Apply Settings?" message:@"This will respring your device." preferredStyle:UIAlertControllerStyleActionSheet]; + UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"Respring" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { - // blur then respring our device! - self.mainAppRootWindow = [UIApplication sharedApplication].keyWindow; - self.respringBlur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]; - self.respringEffectView = [[UIVisualEffectView alloc] initWithEffect:self.respringBlur]; - self.respringEffectView.frame = [[UIScreen mainScreen] bounds]; - [self.mainAppRootWindow addSubview:self.respringEffectView]; - [UIView beginAnimations:nil context:NULL]; - [UIView setAnimationDuration:5.0]; - [self.respringEffectView setAlpha:0]; - [UIView commitAnimations]; + [self performSelector:@selector(respring) withObject:nil afterDelay:0.0]; - [self performSelector:@selector(respring) withObject:nil afterDelay:3.0]; + }]; - }]; + UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]; - UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]; + [confirmRespringAlert addAction:cancel]; + [confirmRespringAlert addAction:confirm]; - [confirmRespringAlert addAction:cancel]; - [confirmRespringAlert addAction:confirm]; - [self presentViewController:confirmRespringAlert animated:YES completion:nil]; + [self presentViewController:confirmRespringAlert animated:YES completion:nil]; } @end