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.

ZNDarkPrefsRootListController.m 4.1KB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #import "ZNDarkPrefsRootListController.h"
  2. #import <CepheiPrefs/HBAppearanceSettings.h>
  3. #define THEME_COLOR \
  4. [UIColor colorWithRed:1.00 \
  5. green:0.00 \
  6. blue:0.00 \
  7. alpha:1.0];
  8. @implementation ZNDarkPrefsRootListController
  9. + (UIColor *)hb_tintColor {
  10. return THEME_COLOR;
  11. }
  12. -(void)viewWillAppear:(BOOL)animated {
  13. [super viewWillAppear:animated];
  14. // share button for our tweak :P
  15. self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(shareTapped)];
  16. }
  17. //share button action
  18. - (void)shareTapped {
  19. NSString *shareText = @"Turn off the lights! It's too bright! Get dark tabs for #Zenith (@Muirey03) by using #ZenithDark from @mac_user669 and @iKilledAppl3! https://mac-user669.github.io/repo/";
  20. UIImage *image = [UIImage imageWithContentsOfFile:kImagePath];
  21. NSArray * itemsToShare = @[shareText, image];
  22. UIActivityViewController *controller = [[UIActivityViewController alloc]initWithActivityItems:itemsToShare applicationActivities:nil];
  23. // and present it
  24. [self presentActivityController:controller];
  25. }
  26. - (void)presentActivityController:(UIActivityViewController *)controller {
  27. // for iPad: make the presentation a Popover
  28. controller.modalPresentationStyle = UIModalPresentationPopover;
  29. [self presentViewController:controller animated:YES completion:nil];
  30. UIPopoverPresentationController *popController = [controller popoverPresentationController];
  31. popController.permittedArrowDirections = UIPopoverArrowDirectionAny;
  32. popController.barButtonItem = self.navigationItem.rightBarButtonItem;
  33. }
  34. - (NSArray *)specifiers {
  35. if (!_specifiers) {
  36. _specifiers = [[self loadSpecifiersFromPlistName:@"Root" target:self] retain];
  37. }
  38. return _specifiers;
  39. }
  40. -(void)followMe {
  41. NSURL *twitter = [NSURL URLWithString:@"https://twitter.com/mac_user669"];
  42. [[UIApplication sharedApplication] openURL:twitter options:@{} completionHandler:nil];
  43. }
  44. -(void)followiKA {
  45. NSURL *twitter = [NSURL URLWithString:@"https://twitter.com/iKilledAppl3"];
  46. [[UIApplication sharedApplication] openURL:twitter options:@{} completionHandler:nil];
  47. }
  48. -(void)followSkitty {
  49. NSURL *twitter = [NSURL URLWithString:@"https://twitter.com/SkittyBlock"];
  50. [[UIApplication sharedApplication] openURL:twitter options:@{} completionHandler:nil];
  51. }
  52. -(void)respring {
  53. NSTask *task = [[[NSTask alloc] init] autorelease];
  54. [task setLaunchPath:@"/usr/bin/killall"];
  55. [task setArguments:[NSArray arrayWithObjects:@"backboardd", nil]];
  56. [task launch];
  57. }
  58. -(void)doAFancyRespring {
  59. UIAlertController *confirmRespringAlert = [UIAlertController alertControllerWithTitle:@"Apply Settings?" message:@"This will respring your device." preferredStyle:UIAlertControllerStyleActionSheet];
  60. UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"Respring" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
  61. // blur then respring our device!
  62. self.mainAppRootWindow = [UIApplication sharedApplication].keyWindow;
  63. self.respringBlur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
  64. self.respringEffectView = [[UIVisualEffectView alloc] initWithEffect:self.respringBlur];
  65. self.respringEffectView.frame = [[UIScreen mainScreen] bounds];
  66. [self.mainAppRootWindow addSubview:self.respringEffectView];
  67. [UIView beginAnimations:nil context:NULL];
  68. [UIView setAnimationDuration:5.0];
  69. [self.respringEffectView setAlpha:0];
  70. [UIView commitAnimations];
  71. [self performSelector:@selector(respring) withObject:nil afterDelay:3.0];
  72. }];
  73. UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
  74. [confirmRespringAlert addAction:cancel];
  75. [confirmRespringAlert addAction:confirm];
  76. [self presentViewController:confirmRespringAlert animated:YES completion:nil];
  77. }
  78. @end