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.3KB

4 jaren geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. //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)doAFancyRespring {
  41. UIAlertController *confirmRespringAlert = [UIAlertController alertControllerWithTitle:@"Apply Settings?" message:@"This will respring your device." preferredStyle:UIAlertControllerStyleActionSheet];
  42. UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"Respring" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
  43. // blur then respring our device!
  44. self.mainAppRootWindow = [UIApplication sharedApplication].keyWindow;
  45. self.respringBlur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
  46. self.respringEffectView = [[UIVisualEffectView alloc] initWithEffect:self.respringBlur];
  47. self.respringEffectView.frame = [[UIScreen mainScreen] bounds];
  48. [self.mainAppRootWindow addSubview:self.respringEffectView];
  49. [UIView beginAnimations:nil context:NULL];
  50. [UIView setAnimationDuration:5.0];
  51. [self.respringEffectView setAlpha:0];
  52. [UIView commitAnimations];
  53. [self performSelector:@selector(respring) withObject:nil afterDelay:3.0];
  54. }];
  55. UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil];
  56. [confirmRespringAlert addAction:cancel];
  57. [confirmRespringAlert addAction:confirm];
  58. [self presentViewController:confirmRespringAlert animated:YES completion:nil];
  59. }
  60. @end