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 3.7KB

4 vuotta sitten
4 vuotta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #import "ZNDarkPrefsRootListController.h"
  2. #import <CepheiPrefs/HBAppearanceSettings.h>
  3. #import <Cephei/HBRespringController.h>
  4. #import <Cephei/HBPreferences.h>
  5. #define THEME_COLOR \
  6. [UIColor colorWithRed:0.82 \
  7. green:0.64 \
  8. blue:0.00 \
  9. alpha:1.0];
  10. @implementation ZNDarkPrefsRootListController
  11. + (UIColor *)hb_tintColor {
  12. return THEME_COLOR;
  13. }
  14. -(void)viewWillAppear:(BOOL)animated {
  15. [super viewWillAppear:animated];
  16. // share button for our tweak :P
  17. self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(shareTapped)];
  18. }
  19. // Hide Large Title
  20. - (void)viewDidLoad {
  21. [super viewDidLoad];
  22. if (@available(iOS 11, *)) {
  23. self.navigationController.navigationBar.prefersLargeTitles = false;
  24. self.navigationController.navigationItem.largeTitleDisplayMode =
  25. UINavigationItemLargeTitleDisplayModeNever;
  26. }
  27. }
  28. - (void)viewDidAppear:(BOOL)animated {
  29. [super viewDidAppear:animated];
  30. if (@available(iOS 11, *)) {
  31. self.navigationController.navigationBar.prefersLargeTitles = false;
  32. self.navigationController.navigationItem.largeTitleDisplayMode =
  33. UINavigationItemLargeTitleDisplayModeNever;
  34. }
  35. }
  36. // End of "Hide Large Title"
  37. //share button action
  38. - (void)shareTapped {
  39. 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/";
  40. UIImage *image = [UIImage imageWithContentsOfFile:kImagePath];
  41. NSArray * itemsToShare = @[shareText, image];
  42. UIActivityViewController *controller = [[UIActivityViewController alloc]initWithActivityItems:itemsToShare applicationActivities:nil];
  43. // and present it
  44. [self presentActivityController:controller];
  45. }
  46. - (void)presentActivityController:(UIActivityViewController *)controller {
  47. // for iPad: make the presentation a Popover
  48. controller.modalPresentationStyle = UIModalPresentationPopover;
  49. [self presentViewController:controller animated:YES completion:nil];
  50. UIPopoverPresentationController *popController = [controller popoverPresentationController];
  51. popController.permittedArrowDirections = UIPopoverArrowDirectionAny;
  52. popController.barButtonItem = self.navigationItem.rightBarButtonItem;
  53. }
  54. - (NSArray *)specifiers {
  55. if (!_specifiers) {
  56. _specifiers = [[self loadSpecifiersFromPlistName:@"Root" target:self] retain];
  57. }
  58. return _specifiers;
  59. }
  60. - (void)respring {
  61. [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil]; // Dismisses keyboard
  62. [HBRespringController respringAndReturnTo:[NSURL URLWithString:@"prefs:root=ZenithDark"]];
  63. }
  64. -(void)respringPopUp {
  65. UIAlertController *confirmRespringAlert = [UIAlertController alertControllerWithTitle:@"Apply Settings?" message:@"This will respring your device." preferredStyle:UIAlertControllerStyleActionSheet];
  66. UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"Respring" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
  67. [self performSelector:@selector(respring) withObject:nil afterDelay:0.0];
  68. }];
  69. UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
  70. [confirmRespringAlert addAction:cancel];
  71. [confirmRespringAlert addAction:confirm];
  72. [self presentViewController:confirmRespringAlert animated:YES completion:nil];
  73. }
  74. @end