Dark tabs for Zenith! Mirror of https://github.com/mac-user669/ZenithDark
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

104 lines
3.5KB

  1. #import "ZNDarkPrefsRootListController.h"
  2. #import <CepheiPrefs/HBAppearanceSettings.h>
  3. #define THEME_COLOR \
  4. [UIColor colorWithRed:0.82 \
  5. green:0.64 \
  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. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. if (@available(iOS 11, *)) {
  20. self.navigationController.navigationBar.prefersLargeTitles = false;
  21. self.navigationController.navigationItem.largeTitleDisplayMode =
  22. UINavigationItemLargeTitleDisplayModeNever;
  23. }
  24. }
  25. - (void)viewDidAppear:(BOOL)animated {
  26. [super viewDidAppear:animated];
  27. if (@available(iOS 11, *)) {
  28. self.navigationController.navigationBar.prefersLargeTitles = false;
  29. self.navigationController.navigationItem.largeTitleDisplayMode =
  30. UINavigationItemLargeTitleDisplayModeNever;
  31. }
  32. }
  33. //share button action
  34. - (void)shareTapped {
  35. 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/";
  36. UIImage *image = [UIImage imageWithContentsOfFile:kImagePath];
  37. NSArray * itemsToShare = @[shareText, image];
  38. UIActivityViewController *controller = [[UIActivityViewController alloc]initWithActivityItems:itemsToShare applicationActivities:nil];
  39. // and present it
  40. [self presentActivityController:controller];
  41. }
  42. - (void)presentActivityController:(UIActivityViewController *)controller {
  43. // for iPad: make the presentation a Popover
  44. controller.modalPresentationStyle = UIModalPresentationPopover;
  45. [self presentViewController:controller animated:YES completion:nil];
  46. UIPopoverPresentationController *popController = [controller popoverPresentationController];
  47. popController.permittedArrowDirections = UIPopoverArrowDirectionAny;
  48. popController.barButtonItem = self.navigationItem.rightBarButtonItem;
  49. }
  50. - (NSArray *)specifiers {
  51. if (!_specifiers) {
  52. _specifiers = [[self loadSpecifiersFromPlistName:@"Root" target:self] retain];
  53. }
  54. return _specifiers;
  55. }
  56. -(void)respring {
  57. NSTask *task = [[[NSTask alloc] init] autorelease];
  58. [task setLaunchPath:@"/usr/bin/killall"];
  59. [task setArguments:[NSArray arrayWithObjects:@"backboardd", nil]];
  60. [task launch];
  61. }
  62. -(void)doAFancyRespring {
  63. UIAlertController *confirmRespringAlert = [UIAlertController alertControllerWithTitle:@"Apply Settings?" message:@"This will respring your device." preferredStyle:UIAlertControllerStyleActionSheet];
  64. UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"Respring" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
  65. [self performSelector:@selector(respring) withObject:nil afterDelay:0.0];
  66. }];
  67. UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
  68. [confirmRespringAlert addAction:cancel];
  69. [confirmRespringAlert addAction:confirm];
  70. [self presentViewController:confirmRespringAlert animated:YES completion:nil];
  71. }
  72. @end