Browse Source

Work on adding iKA's pull. I feel like i'm not doing something right...

master
Cooper Hull 4 years ago
parent
commit
2e26dc9082
13 changed files with 0 additions and 287 deletions
  1. +0
    -19
      Makefile
  2. +0
    -2
      README.md
  3. +0
    -79
      Tweak.xm
  4. +0
    -26
      ZenithDark.h
  5. +0
    -1
      ZenithDark.plist
  6. +0
    -11
      control
  7. BIN
      packages/com.mac-user669.zenithdark_1.0_iphoneos-arm.deb
  8. +0
    -17
      zenithdarkprefs/Makefile
  9. +0
    -24
      zenithdarkprefs/Resources/Info.plist
  10. +0
    -42
      zenithdarkprefs/Resources/Root.plist
  11. +0
    -5
      zenithdarkprefs/ZnthDrkRootListController.h
  12. +0
    -40
      zenithdarkprefs/ZnthDrkRootListController.m
  13. +0
    -21
      zenithdarkprefs/entry.plist

+ 0
- 19
Makefile View File

@@ -1,19 +0,0 @@
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

+ 0
- 2
README.md View File

@@ -1,2 +0,0 @@
# ZenithDark
Dark tabs for Zenith! Availible on [mac-user669's repo](https://mac-user669.github.io/repo/)

+ 0
- 79
Tweak.xm View File

@@ -1,79 +0,0 @@
/*

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);

}

+ 0
- 26
ZenithDark.h View File

@@ -1,26 +0,0 @@
/*

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]

+ 0
- 1
ZenithDark.plist View File

@@ -1 +0,0 @@
{ Filter = { Bundles = ( "com.apple.springboard" ); }; }

+ 0
- 11
control View File

@@ -1,11 +0,0 @@
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/

BIN
packages/com.mac-user669.zenithdark_1.0_iphoneos-arm.deb View File


+ 0
- 17
zenithdarkprefs/Makefile View File

@@ -1,17 +0,0 @@
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)

+ 0
- 24
zenithdarkprefs/Resources/Info.plist View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>ZenithDarkPrefs</string>
<key>CFBundleIdentifier</key>
<string>com.mac-user669.zenithdarkprefs</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSPrincipalClass</key>
<string>ZnthDrkRootListController</string>
</dict>
</plist>

+ 0
- 42
zenithdarkprefs/Resources/Root.plist View File

@@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Enable</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>defaults</key>
<string>com.mac-user669.zenithdarkprefs</string>
<key>key</key>
<string>enabled</string>
<key>label</key>
<string>Enable</string>
</dict>

<dict>
<key>cell</key>
<string>PSGroupCell</string>
</dict>
<dict>
<key>cell</key>
<string>PSButtonCell</string>
<key>label</key>
<string>@mac_user669</string>
<key>action</key>
<string>openTwitter</string>
</dict>
</array>
<key>title</key>
<string>ZenithDark</string>
</dict>
</plist>

+ 0
- 5
zenithdarkprefs/ZnthDrkRootListController.h View File

@@ -1,5 +0,0 @@
#import <Preferences/PSListController.h>

@interface ZnthDrkRootListController : PSListController

@end

+ 0
- 40
zenithdarkprefs/ZnthDrkRootListController.m View File

@@ -1,40 +0,0 @@
#import "ZnthDrkRootListController.h"
#import <spawn.h>
@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

+ 0
- 21
zenithdarkprefs/entry.plist View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>entry</key>
<dict>
<key>bundle</key>
<string>ZenithDarkPrefs</string>
<key>cell</key>
<string>PSLinkCell</string>
<key>detail</key>
<string>ZnthDrkRootListController</string>
<key>icon</key>
<string>icon.png</string>
<key>isController</key>
<true/>
<key>label</key>
<string>ZenithDarkPrefs</string>
</dict>
</dict>
</plist>

Loading…
Cancel
Save