From fbd2b19bc86bdd9d266c2bbe2751933e78c5be00 Mon Sep 17 00:00:00 2001 From: mac-user669 Date: Sun, 19 Jan 2020 09:32:20 -0500 Subject: [PATCH] Revert "Work on adding iKA's pull. I feel like i'm not doing something right..." This reverts commit 2e26dc90824fa33fd3a75ab514872c7db9da35e8. --- Makefile | 19 +++++ README.md | 2 + Tweak.xm | 79 ++++++++++++++++++ ZenithDark.h | 26 ++++++ ZenithDark.plist | 1 + control | 11 +++ ...ac-user669.zenithdark_1.0_iphoneos-arm.deb | Bin 0 -> 7914 bytes zenithdarkprefs/Makefile | 17 ++++ zenithdarkprefs/Resources/Info.plist | 24 ++++++ zenithdarkprefs/Resources/Root.plist | 42 ++++++++++ zenithdarkprefs/ZnthDrkRootListController.h | 5 ++ zenithdarkprefs/ZnthDrkRootListController.m | 40 +++++++++ zenithdarkprefs/entry.plist | 21 +++++ 13 files changed, 287 insertions(+) create mode 100644 Makefile create mode 100644 README.md create mode 100644 Tweak.xm create mode 100644 ZenithDark.h create mode 100644 ZenithDark.plist create mode 100644 control create mode 100644 packages/com.mac-user669.zenithdark_1.0_iphoneos-arm.deb create mode 100644 zenithdarkprefs/Makefile create mode 100644 zenithdarkprefs/Resources/Info.plist create mode 100644 zenithdarkprefs/Resources/Root.plist create mode 100644 zenithdarkprefs/ZnthDrkRootListController.h create mode 100644 zenithdarkprefs/ZnthDrkRootListController.m create mode 100644 zenithdarkprefs/entry.plist diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6387a69 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +ARCHS = arm64 arm64e +SDK = iPhoneOS13.0 +FINALPACKAGE = 1 +export TARGET = iphone:clang:13.0:latest + +include $(THEOS)/makefiles/common.mk + +TWEAK_NAME = ZenithDark + +ZenithDark_FILES = Tweak.xm +ZenithDark_CFLAGS = -fobjc-arc +ZenithDark_FRAMEWORKS = UIKit CoreGraphics + +include $(THEOS_MAKE_PATH)/tweak.mk + +after-install:: + install.exec "sbreload" +SUBPROJECTS += zenithdarkprefs +include $(THEOS_MAKE_PATH)/aggregate.mk diff --git a/README.md b/README.md new file mode 100644 index 0000000..c0a434e --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# ZenithDark +Dark tabs for Zenith! Availible on [mac-user669's repo](https://mac-user669.github.io/repo/) \ No newline at end of file diff --git a/Tweak.xm b/Tweak.xm new file mode 100644 index 0000000..fbd9fd6 --- /dev/null +++ b/Tweak.xm @@ -0,0 +1,79 @@ +/* + +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" + +static BOOL enabled; +static void loadPrefs() { + static NSMutableDictionary *settings; + + CFArrayRef keyList = CFPreferencesCopyKeyList(CFSTR("com.mac-user669.zenithdarkprefs"), kCFPreferencesCurrentUser, kCFPreferencesAnyHost); + if (keyList) { + settings = (NSMutableDictionary *)CFBridgingRelease(CFPreferencesCopyMultiple(keyList, CFSTR("com.mac-user669.zenithdarkprefs"), kCFPreferencesCurrentUser, kCFPreferencesAnyHost)); + CFRelease(keyList); + } else { + settings = [NSMutableDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.mac-user669.zenithdarkprefs.plist"]; + } + + enabled = [([settings objectForKey:@"enabled"] ? [settings objectForKey:@"enabled"] : @(YES)) boolValue]; +} + +// 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 { + if (enabled) { + %orig(previousTraitCollection); + if (@available(iOS 13, *)) { + if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { + [self setBackgroundColor:kDarkModeColor]; + } + + else { + [self setBackgroundColor:kLightModeColor]; + } + } + } + %orig; +} + +// 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 { + if (enabled) { + // by default have our tweak overide this. + if (@available(iOS 13, *)) { + if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { + %orig(kDarkModeColor); + } + + else { + %orig; + } + } + } + %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 { + +loadPrefs(); + +// 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); + +} \ No newline at end of file diff --git a/ZenithDark.h b/ZenithDark.h new file mode 100644 index 0000000..c14944a --- /dev/null +++ b/ZenithDark.h @@ -0,0 +1,26 @@ +/* + +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). + +ZenithDark Header file to keep the tweak.x file clean! + + +*/ + + +// We then import UIKit so we can override the color property without this Theos doesn't have a clue what those properties are. +@import UIKit; + +// We make an interface to let Theos know that ZNGrabberAccessoryView is of type UIImageView. +@interface ZNGrabberAccessoryView : UIImageView +@end + +// Dark Zenith color we are using macros so we can call it later if need be. +#define kDarkModeColor [UIColor colorWithWhite:0.0 alpha:0.44] + +// Stock Zenith color we are using macros so we can call it later if need be. +#define kLightModeColor [UIColor colorWithWhite:1.0 alpha:0.7] diff --git a/ZenithDark.plist b/ZenithDark.plist new file mode 100644 index 0000000..10dc654 --- /dev/null +++ b/ZenithDark.plist @@ -0,0 +1 @@ +{ Filter = { Bundles = ( "com.apple.springboard" ); }; } diff --git a/control b/control new file mode 100644 index 0000000..d98404b --- /dev/null +++ b/control @@ -0,0 +1,11 @@ +Package: com.mac-user669.zenithdark +Version: 1.0 +Architecture: iphoneos-arm +Maintainer: mac-user669 +Depends: mobilesubstrate, com.muirey03.zenith, firmware (>=13.0) +Section: Tweaks +Description: Changes Zeniths tabs to a dark blur +Author: mac-user669 +Name: ZenithDark +Sileodepiction: https://raw.githubusercontent.com/mac-user669/repo/master/sileodepictions/ZenithDark.json +Depiction: https://mac-user669.github.io/repo/depictions/?p=com.mac-user669.zenithdark/ diff --git a/packages/com.mac-user669.zenithdark_1.0_iphoneos-arm.deb b/packages/com.mac-user669.zenithdark_1.0_iphoneos-arm.deb new file mode 100644 index 0000000000000000000000000000000000000000..6ac9a873abb87fe1d1020900d5137081931b0aa5 GIT binary patch literal 7914 zcma))Q*b2!gRFxSI}_Wst%+^xL?<>U$wU)pf)g7P+s4Gk#I|i?|GIbYeckQq>Z*R| zr?1I{fUf4&B8V22W;Q@aW-}W{psNoV85uh_FF!j62Rko285!Gu`u|IIHZ~qEE;6$J z_`hX}$ic#fXzt|b?&@UE;tq6W0sZ)2?AbW~|DH4&9^%cP)EEl-LZjEVPYivM-=uCB z$Gzbn)odWMI;(Ia7L)LObEHNC_X@NU1PE7#AFIyzvi|+h-w=s67B6& zMRi>wW7hNla^bC|>b}IO+sLq*j(L`U(9h=`rGRNPsF!IPP>Vv0OXlc)sj$D}oYZ-R zF33~VR;;=3?eDJUCS-94Sh6z4D=7TpkC0#HOYJ z>?@{>eWI2BF2c^E&o4b`hmucZy&^78Z+89xJ{j{iYQqel(K1lo^!hqQHSA8^@ua%F zdSP%4uX(#6*l!yzArK)T5G{c2!2bi&{)YqbKcxPrKk#z0^Zj3-riexm5Dci8Ov-Q=L(~M zsDFbs1Y>4Q?aC4rYF3t_UokuSStn_yf-_~pLMtxP(fpPcQn+V*yOz8K(@>+b{ad0wch`}_)dGKIW^(YOGfyu}g7D#5d)$tT zgrWQ3@RK^%!0ot-nzpe_si&f~4slhJ4jsi9bVTKgDZ^;k zgxd-4iC*l0OMI>zCbn<+M8kn(ldQBv3m}kcWjHCnY0^d7Plyz1+)qn@XMZyK!H_!G zfXC;B{;N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Dd3>g_*Ulo*m~)yX@S9iupj&9IBwZ^3#EV7=6oKP>rb3}p}dFHt@so&W#< literal 0 HcmV?d00001 diff --git a/zenithdarkprefs/Makefile b/zenithdarkprefs/Makefile new file mode 100644 index 0000000..aab3c31 --- /dev/null +++ b/zenithdarkprefs/Makefile @@ -0,0 +1,17 @@ +include $(THEOS)/makefiles/common.mk + +ARCHS = arm64 arm64e +export TARGET = iphone:clang:13.0:latest +BUNDLE_NAME = ZenithDarkPrefs + +ZenithDarkPrefs_FILES = ZnthDrkRootListController.m +ZenithDarkPrefs_INSTALL_PATH = /Library/PreferenceBundles +ZenithDarkPrefs_FRAMEWORKS = UIKit +ZenithDarkPrefs_PRIVATE_FRAMEWORKS = Preferences +ZenithDarkPrefs_CFLAGS = -fobjc-arc + +include $(THEOS_MAKE_PATH)/bundle.mk + +internal-stage:: + $(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END) + $(ECHO_NOTHING)cp entry.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/ZenithDarkPrefs.plist$(ECHO_END) diff --git a/zenithdarkprefs/Resources/Info.plist b/zenithdarkprefs/Resources/Info.plist new file mode 100644 index 0000000..86d931a --- /dev/null +++ b/zenithdarkprefs/Resources/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ZenithDarkPrefs + CFBundleIdentifier + com.mac-user669.zenithdarkprefs + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSPrincipalClass + ZnthDrkRootListController + + diff --git a/zenithdarkprefs/Resources/Root.plist b/zenithdarkprefs/Resources/Root.plist new file mode 100644 index 0000000..727bd0f --- /dev/null +++ b/zenithdarkprefs/Resources/Root.plist @@ -0,0 +1,42 @@ + + + + + items + + + cell + PSGroupCell + label + Enable + + + cell + PSSwitchCell + default + + defaults + com.mac-user669.zenithdarkprefs + key + enabled + label + Enable + + + + cell + PSGroupCell + + + cell + PSButtonCell + label + @mac_user669 + action + openTwitter + + + title + ZenithDark + + \ No newline at end of file diff --git a/zenithdarkprefs/ZnthDrkRootListController.h b/zenithdarkprefs/ZnthDrkRootListController.h new file mode 100644 index 0000000..07cc78a --- /dev/null +++ b/zenithdarkprefs/ZnthDrkRootListController.h @@ -0,0 +1,5 @@ +#import + +@interface ZnthDrkRootListController : PSListController + +@end diff --git a/zenithdarkprefs/ZnthDrkRootListController.m b/zenithdarkprefs/ZnthDrkRootListController.m new file mode 100644 index 0000000..4c559f8 --- /dev/null +++ b/zenithdarkprefs/ZnthDrkRootListController.m @@ -0,0 +1,40 @@ +#import "ZnthDrkRootListController.h" +#import +@implementation ZnthDrkRootListController + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + UIBarButtonItem *applyButton = [[UIBarButtonItem alloc] initWithTitle:@"Apply" style:UIBarButtonItemStylePlain target:self action:@selector(respringDevice)]; + self.navigationItem.rightBarButtonItem = applyButton; +} + +- (NSArray *)specifiers { + if (!_specifiers) { + _specifiers = [self loadSpecifiersFromPlistName:@"Root" target:self]; + } + + return _specifiers; +} + +- (void) respringDevice { + UIAlertController *confirmRespringAlert = [UIAlertController alertControllerWithTitle:@"Apply settings?" message:@"This will respring your device" preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + pid_t pid; + const char *argv[] = {"sbreload", NULL}; + posix_spawn(&pid, "/usr/bin/sbreload", NULL, NULL, (char* const*)argv, NULL); + }]; + + UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]; + + [confirmRespringAlert addAction:cancel]; + [confirmRespringAlert addAction:confirm]; + + [self presentViewController:confirmRespringAlert animated:YES completion:nil]; +} + +-(void)openTwitter { + NSURL *twitter = [NSURL URLWithString:@"https://twitter.com/mac_user669"]; + [[UIApplication sharedApplication] openURL:twitter options:@{} completionHandler:nil]; +} + +@end diff --git a/zenithdarkprefs/entry.plist b/zenithdarkprefs/entry.plist new file mode 100644 index 0000000..9b0cc13 --- /dev/null +++ b/zenithdarkprefs/entry.plist @@ -0,0 +1,21 @@ + + + + + entry + + bundle + ZenithDarkPrefs + cell + PSLinkCell + detail + ZnthDrkRootListController + icon + icon.png + isController + + label + ZenithDarkPrefs + + +