Dark tabs for Zenith! Mirror of https://github.com/mac-user669/ZenithDark
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

ZnthDrkRootListController.m 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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