1.0-1 release

- No code base changes.
- Makefile adjustment
- This should work the way it's supposed to.
This commit is contained in:
iKilledAppl3
2020-01-13 11:18:33 -05:00
parent e0ef88c341
commit c273e2b93d
36 changed files with 58 additions and 119 deletions

55
Tweak.xm Normal file
View File

@ -0,0 +1,55 @@
/*
Dark Mode for Zenith's Grabber view!
Copyright 2020 J.K. Hayslip (@iKilledAppl3) & ToxicAppl3 INSDC/iKilledAppl3 LLC.
All code was written for learning purposes and credit must be given to the original author.
Written for Cooper Hull, @(mac-user669).
*/
#import "ZenithDark.h"
// We then hook the class in this case Zenith's grabber view is called “ZNGrabberAccessoryView”
%hook ZNGrabberAccessoryView
// this is called when iOS 13's dark mode is enabled!
-(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
%orig(previousTraitCollection);
if (@available(iOS 13, *)) {
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
[self setBackgroundColor:kDarkModeColor];
}
else {
[self setBackgroundColor:kLightModeColor];
}
}
}
// the method we modify is this method that is called from UIImageView to set the backgroundColor of the image view.
// Since the grabber view is of type UIImageView we can modify this method :)
-(void)setBackgroundColor:(UIColor *)backgroundColor {
// by default have our tweak overide this.
if (@available(iOS 13, *)) {
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
%orig(kDarkModeColor);
}
else {
%orig;
}
}
}
// we need to make sure we tell theos that we are finished hooking this class not doing so with cause the end of the world :P
%end
// our constructor
%ctor {
// We use this to make sure we load Zenith's dynamic library at runtime so we can modify it with our tweak.
dlopen ("/Library/MobileSubstrate/DynamicLibraries/Zenith.dylib", RTLD_NOW);
}