Dark tabs for Zenith! Mirror of https://github.com/mac-user669/ZenithDark
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

88 líneas
3.3KB

  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