Dark tabs for Zenith! Mirror of https://github.com/mac-user669/ZenithDark
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.5KB

  1. #import "ZnthDrkRootListController.h"
  2. #import <spawn.h>
  3. @implementation ZnthDrkRootListController
  4. - (void)viewWillAppear:(BOOL)animated {
  5. [super viewWillAppear:animated];
  6. UIBarButtonItem *applyButton = [[UIBarButtonItem alloc] initWithTitle:@"Apply" style:UIBarButtonItemStylePlain target:self action:@selector(respringDevice)];
  7. self.navigationItem.rightBarButtonItem = applyButton;
  8. }
  9. - (NSArray *)specifiers {
  10. if (!_specifiers) {
  11. _specifiers = [self loadSpecifiersFromPlistName:@"Root" target:self];
  12. }
  13. return _specifiers;
  14. }
  15. - (void) respringDevice {
  16. UIAlertController *confirmRespringAlert = [UIAlertController alertControllerWithTitle:@"Apply settings?" message:@"This will respring your device" preferredStyle:UIAlertControllerStyleAlert];
  17. UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  18. pid_t pid;
  19. const char *argv[] = {"sbreload", NULL};
  20. posix_spawn(&pid, "/usr/bin/sbreload", NULL, NULL, (char* const*)argv, NULL);
  21. }];
  22. UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
  23. [confirmRespringAlert addAction:cancel];
  24. [confirmRespringAlert addAction:confirm];
  25. [self presentViewController:confirmRespringAlert animated:YES completion:nil];
  26. }
  27. -(void)openTwitter {
  28. NSURL *twitter = [NSURL URLWithString:@"https://twitter.com/mac_user669"];
  29. [[UIApplication sharedApplication] openURL:twitter options:@{} completionHandler:nil];
  30. }
  31. @end