Fix Respring
This commit is contained in:
35
zenithdarkprefs/NSTask.h
Normal file
35
zenithdarkprefs/NSTask.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
@interface NSTask : NSObject
|
||||||
|
|
||||||
|
@property (copy) NSArray *arguments;
|
||||||
|
@property (copy) NSString *currentDirectoryPath;
|
||||||
|
@property (copy) NSDictionary *environment;
|
||||||
|
@property (copy) NSString *launchPath;
|
||||||
|
@property (readonly) int processIdentifier;
|
||||||
|
@property long long qualityOfService;
|
||||||
|
@property (getter=isRunning, readonly) bool running;
|
||||||
|
@property (retain) id standardError;
|
||||||
|
@property (retain) id standardInput;
|
||||||
|
@property (retain) id standardOutput;
|
||||||
|
@property (copy) id /* block */ terminationHandler;
|
||||||
|
@property (readonly) long long terminationReason;
|
||||||
|
@property (readonly) int terminationStatus;
|
||||||
|
|
||||||
|
+ (id)currentTaskDictionary;
|
||||||
|
+ (id)launchedTaskWithDictionary:(id)arg1;
|
||||||
|
+ (id)launchedTaskWithLaunchPath:(id)arg1 arguments:(id)arg2;
|
||||||
|
|
||||||
|
- (id)init;
|
||||||
|
- (void)interrupt;
|
||||||
|
- (bool)isRunning;
|
||||||
|
- (void)launch;
|
||||||
|
- (int)processIdentifier;
|
||||||
|
- (long long)qualityOfService;
|
||||||
|
- (bool)resume;
|
||||||
|
- (bool)suspend;
|
||||||
|
- (long long)suspendCount;
|
||||||
|
- (void)terminate;
|
||||||
|
- (id /* block */)terminationHandler;
|
||||||
|
- (long long)terminationReason;
|
||||||
|
- (int)terminationStatus;
|
||||||
|
|
||||||
|
@end
|
@ -146,7 +146,7 @@
|
|||||||
<key>cellClass</key>
|
<key>cellClass</key>
|
||||||
<string>HBTintedTableCell</string>
|
<string>HBTintedTableCell</string>
|
||||||
<key>action</key>
|
<key>action</key>
|
||||||
<string>respringPopUp</string>
|
<string>respring</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
||||||
<dict>
|
<dict>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#import "ZNDarkPrefsRootListController.h"
|
#import "ZNDarkPrefsRootListController.h"
|
||||||
#include <CSColorPicker/CSColorPicker.h>
|
#include <CSColorPicker/CSColorPicker.h>
|
||||||
|
#import "NSTask.h"
|
||||||
|
|
||||||
#define THEME_COLOR \
|
#define THEME_COLOR \
|
||||||
[UIColor colorWithRed:0.96 \
|
[UIColor colorWithRed:0.96 \
|
||||||
@ -21,17 +22,6 @@
|
|||||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(shareTapped)];
|
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(shareTapped)];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)resetSettings {
|
|
||||||
CFArrayRef keyList = CFPreferencesCopyKeyList(CFSTR("com.mac-user669.zenithdark"), kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
|
||||||
if (keyList) {
|
|
||||||
CFPreferencesSetMultiple(nil, keyList, CFSTR("com.mac-user669.zenithdark"), kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
|
||||||
CFRelease(keyList);
|
|
||||||
}
|
|
||||||
[[NSFileManager defaultManager] removeItemAtPath:@"/var/mobile/Library/Preferences/com.mac-user669.zenithdark.plist" error:nil];
|
|
||||||
|
|
||||||
[self respring];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide Large Title
|
// Hide Large Title
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
@ -54,7 +44,6 @@
|
|||||||
}
|
}
|
||||||
// End of "Hide Large Title"
|
// End of "Hide Large Title"
|
||||||
|
|
||||||
|
|
||||||
//share button action
|
//share button action
|
||||||
- (void)shareTapped {
|
- (void)shareTapped {
|
||||||
|
|
||||||
@ -89,27 +78,37 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)respring {
|
-(void)respring {
|
||||||
[[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil]; // Dismisses keyboard
|
UIAlertController *respring = [UIAlertController alertControllerWithTitle:@"ZenithDark"
|
||||||
[HBRespringController respringAndReturnTo:[NSURL URLWithString:@"prefs:root=ZenithDark"]];
|
message:@"Do you want to Respring?"
|
||||||
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:@"Confirm" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * action) {
|
||||||
|
[self respringUtil];
|
||||||
|
}];
|
||||||
|
|
||||||
|
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
|
||||||
|
[respring addAction:confirmAction];
|
||||||
|
[respring addAction:cancelAction];
|
||||||
|
[self presentViewController:respring animated:YES completion:nil];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)respringPopUp {
|
-(void)respringUtil {
|
||||||
|
NSTask *t = [[NSTask alloc] init];
|
||||||
|
[t setLaunchPath:@"/usr/bin/killall"];
|
||||||
|
[t setArguments:[NSArray arrayWithObjects:@"backboardd", nil]];
|
||||||
|
[t launch];
|
||||||
|
}
|
||||||
|
|
||||||
UIAlertController *confirmRespringAlert = [UIAlertController alertControllerWithTitle:@"Apply Settings?" message:@"This will respring your device." preferredStyle:UIAlertControllerStyleActionSheet];
|
- (void)resetSettings {
|
||||||
UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"Respring" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
|
CFArrayRef keyList = CFPreferencesCopyKeyList(CFSTR("com.mac-user669.zenithdark"), kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||||
|
if (keyList) {
|
||||||
|
CFPreferencesSetMultiple(nil, keyList, CFSTR("com.mac-user669.zenithdark"), kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||||
|
CFRelease(keyList);
|
||||||
|
}
|
||||||
|
[[NSFileManager defaultManager] removeItemAtPath:@"/var/mobile/Library/Preferences/com.mac-user669.zenithdark.plist" error:nil];
|
||||||
|
|
||||||
[self performSelector:@selector(respring) withObject:nil afterDelay:0.0];
|
[self respringUtil];
|
||||||
|
|
||||||
}];
|
|
||||||
|
|
||||||
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
|
|
||||||
|
|
||||||
[confirmRespringAlert addAction:cancel];
|
|
||||||
[confirmRespringAlert addAction:confirm];
|
|
||||||
|
|
||||||
|
|
||||||
[self presentViewController:confirmRespringAlert animated:YES completion:nil];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Reference in New Issue
Block a user