Dark tabs for Zenith! Mirror of https://github.com/mac-user669/ZenithDark
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #line 1 "Tweak.xm"
  2. #import "ZenithDark.h"
  3. static BOOL enabled;
  4. static BOOL replaceOriginalView;
  5. static BOOL notificationBadgesEnabled;
  6. static void loadPrefs() {
  7. static NSMutableDictionary *settings;
  8. CFArrayRef keyList = CFPreferencesCopyKeyList(CFSTR("com.mac-user669.zenithdarkprefs"), kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
  9. if (keyList) {
  10. settings = (NSMutableDictionary *)CFBridgingRelease(CFPreferencesCopyMultiple(keyList, CFSTR("com.mac-user669.zenithdarkprefs"), kCFPreferencesCurrentUser, kCFPreferencesAnyHost));
  11. CFRelease(keyList);
  12. } else {
  13. settings = [NSMutableDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.mac-user669.zenithdarkprefs.plist"];
  14. }
  15. enabled = [([settings objectForKey:@"enabled"] ? [settings objectForKey:@"enabled"] : @(YES)) boolValue];
  16. replaceOriginalView = [([settings objectForKey:@"replaceoriginalview"] ? [settings objectForKey:@"replaceoriginalview"] : @(YES)) boolValue];
  17. notificationBadgesEnabled = [([settings objectForKey:@"notificationBadgesEnabled"] ? [settings objectForKey:@"notificationBadgesEnabled"] : NO) boolValue];
  18. }
  19. #include <substrate.h>
  20. #if defined(__clang__)
  21. #if __has_feature(objc_arc)
  22. #define _LOGOS_SELF_TYPE_NORMAL __unsafe_unretained
  23. #define _LOGOS_SELF_TYPE_INIT __attribute__((ns_consumed))
  24. #define _LOGOS_SELF_CONST const
  25. #define _LOGOS_RETURN_RETAINED __attribute__((ns_returns_retained))
  26. #else
  27. #define _LOGOS_SELF_TYPE_NORMAL
  28. #define _LOGOS_SELF_TYPE_INIT
  29. #define _LOGOS_SELF_CONST
  30. #define _LOGOS_RETURN_RETAINED
  31. #endif
  32. #else
  33. #define _LOGOS_SELF_TYPE_NORMAL
  34. #define _LOGOS_SELF_TYPE_INIT
  35. #define _LOGOS_SELF_CONST
  36. #define _LOGOS_RETURN_RETAINED
  37. #endif
  38. @class ZNGrabberAccessoryView;
  39. static void (*_logos_orig$_ungrouped$ZNGrabberAccessoryView$traitCollectionDidChange$)(_LOGOS_SELF_TYPE_NORMAL ZNGrabberAccessoryView* _LOGOS_SELF_CONST, SEL, UITraitCollection *); static void _logos_method$_ungrouped$ZNGrabberAccessoryView$traitCollectionDidChange$(_LOGOS_SELF_TYPE_NORMAL ZNGrabberAccessoryView* _LOGOS_SELF_CONST, SEL, UITraitCollection *); static void (*_logos_orig$_ungrouped$ZNGrabberAccessoryView$setBackgroundColor$)(_LOGOS_SELF_TYPE_NORMAL ZNGrabberAccessoryView* _LOGOS_SELF_CONST, SEL, UIColor *); static void _logos_method$_ungrouped$ZNGrabberAccessoryView$setBackgroundColor$(_LOGOS_SELF_TYPE_NORMAL ZNGrabberAccessoryView* _LOGOS_SELF_CONST, SEL, UIColor *);
  40. #line 35 "Tweak.xm"
  41. static void _logos_method$_ungrouped$ZNGrabberAccessoryView$traitCollectionDidChange$(_LOGOS_SELF_TYPE_NORMAL ZNGrabberAccessoryView* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UITraitCollection * previousTraitCollection) {
  42. _logos_orig$_ungrouped$ZNGrabberAccessoryView$traitCollectionDidChange$(self, _cmd, previousTraitCollection);
  43. if (@available(iOS 13, *)) {
  44. if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
  45. [self setBackgroundColor:kDarkModeColor];
  46. }
  47. else {
  48. [self setBackgroundColor:kLightModeColor];
  49. }
  50. }
  51. }
  52. static void _logos_method$_ungrouped$ZNGrabberAccessoryView$setBackgroundColor$(_LOGOS_SELF_TYPE_NORMAL ZNGrabberAccessoryView* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, UIColor * backgroundColor) {
  53. if (@available(iOS 13, *)) {
  54. if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
  55. _logos_orig$_ungrouped$ZNGrabberAccessoryView$setBackgroundColor$(self, _cmd, kDarkModeColor);
  56. }
  57. else {
  58. _logos_orig$_ungrouped$ZNGrabberAccessoryView$setBackgroundColor$(self, _cmd, backgroundColor);
  59. }
  60. }
  61. }
  62. static __attribute__((constructor)) void _logosLocalCtor_bbe4a825(int __unused argc, char __unused **argv, char __unused **envp) {
  63. loadPrefs();
  64. dlopen ("/Library/MobileSubstrate/DynamicLibraries/Zenith.dylib", RTLD_NOW);
  65. }
  66. static __attribute__((constructor)) void _logosLocalInit() {
  67. {Class _logos_class$_ungrouped$ZNGrabberAccessoryView = objc_getClass("ZNGrabberAccessoryView"); MSHookMessageEx(_logos_class$_ungrouped$ZNGrabberAccessoryView, @selector(traitCollectionDidChange:), (IMP)&_logos_method$_ungrouped$ZNGrabberAccessoryView$traitCollectionDidChange$, (IMP*)&_logos_orig$_ungrouped$ZNGrabberAccessoryView$traitCollectionDidChange$);MSHookMessageEx(_logos_class$_ungrouped$ZNGrabberAccessoryView, @selector(setBackgroundColor:), (IMP)&_logos_method$_ungrouped$ZNGrabberAccessoryView$setBackgroundColor$, (IMP*)&_logos_orig$_ungrouped$ZNGrabberAccessoryView$setBackgroundColor$);} }
  68. #line 77 "Tweak.xm"