From 2449378a847ac8405230645a7d23f3aa8b0817e2 Mon Sep 17 00:00:00 2001 From: exoticswingset <58611901+exoticswingset@users.noreply.github.com> Date: Fri, 3 Jan 2020 00:18:09 -0500 Subject: [PATCH] Update V2.0 --- Makefile | 4 +- Tweak.x | 27 ++++++- control | 2 +- truthfuldockprefs/Makefile | 15 ++++ truthfuldockprefs/Resources/Info.plist | 24 ++++++ truthfuldockprefs/Resources/Root.plist | 93 +++++++++++++++++++++++ truthfuldockprefs/TDPRootListController.h | 5 ++ truthfuldockprefs/TDPRootListController.m | 23 ++++++ truthfuldockprefs/entry.plist | 21 +++++ 9 files changed, 210 insertions(+), 4 deletions(-) create mode 100644 truthfuldockprefs/Makefile create mode 100644 truthfuldockprefs/Resources/Info.plist create mode 100644 truthfuldockprefs/Resources/Root.plist create mode 100644 truthfuldockprefs/TDPRootListController.h create mode 100644 truthfuldockprefs/TDPRootListController.m create mode 100644 truthfuldockprefs/entry.plist diff --git a/Makefile b/Makefile index 3f5103d..e4975bd 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ INSTALL_TARGET_PROCESSES = SpringBoard -ARCHS = armv7 armv7s arm64 arm64e +ARCHS = arm64e arm64 armv7 armv7s include ~/theos/makefiles/common.mk TWEAK_NAME = TruthfulDock @@ -8,3 +8,5 @@ TruthfulDock_FILES = Tweak.x TruthfulDock_CFLAGS = -fobjc-arc include ~/theos/makefiles/tweak.mk +SUBPROJECTS += truthfuldockprefs +include $(THEOS_MAKE_PATH)/aggregate.mk diff --git a/Tweak.x b/Tweak.x index e9c432c..4ad42e4 100644 --- a/Tweak.x +++ b/Tweak.x @@ -1,5 +1,28 @@ %hook SBDockView + -(void)setBackgroundAlpha:(double)arg1 { -%orig(0.0); + + NSDictionary *bundleDefaults = [[NSUserDefaults standardUserDefaults]persistentDomainForName:@"com.exoticswingset.truthfuldockprefs"]; + id isTweakEnabled = [bundleDefaults valueForKey:@"isTweakEnabled"]; + double alphaValue = [[bundleDefaults valueForKey:@"alphaValue"]doubleValue]; + + if ([isTweakEnabled isEqual:@0]) { + %orig; + } else { + %orig(alphaValue); + } } -%end + +-(BOOL)isDockInset { + NSDictionary *bundleDefaults = [[NSUserDefaults standardUserDefaults]persistentDomainForName:@"com.exoticswingset.truthfuldockprefs"]; + id isTweakEnabled = [bundleDefaults valueForKey:@"isTweakEnabled"]; + id classicDockEnabled = [bundleDefaults valueForKey:@"classicDockEnabled"]; + if ([isTweakEnabled isEqual:@0]) { + return %orig; + } else if ([classicDockEnabled isEqual:@0]) { + return %orig; + } else { + return NO; + } +} +%end \ No newline at end of file diff --git a/control b/control index dbe9f24..0aa8e7a 100644 --- a/control +++ b/control @@ -1,7 +1,7 @@ Package: com.exoticswingset.truthfuldock Name: TruthfulDock Depends: mobilesubstrate -Version: 0.0.2 +Version: 2.0 Architecture: iphoneos-arm Description: An awesome MobileSubstrate tweak! Maintainer: ExoticSwingset diff --git a/truthfuldockprefs/Makefile b/truthfuldockprefs/Makefile new file mode 100644 index 0000000..e38d255 --- /dev/null +++ b/truthfuldockprefs/Makefile @@ -0,0 +1,15 @@ +include ~/theos/makefiles/common.mk +ARCHS = arm64e arm64 armv7 armv7s +BUNDLE_NAME = TruthfulDockPrefs + +TruthfulDockPrefs_FILES = TDPRootListController.m +TruthfulDockPrefs_INSTALL_PATH = /Library/PreferenceBundles +TruthfulDockPrefs_FRAMEWORKS = UIKit +TruthfulDockPrefs_PRIVATE_FRAMEWORKS = Preferences +TruthfulDockPrefs_CFLAGS = -fobjc-arc + +include ~/theos/makefiles/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/TruthfulDockPrefs.plist$(ECHO_END) diff --git a/truthfuldockprefs/Resources/Info.plist b/truthfuldockprefs/Resources/Info.plist new file mode 100644 index 0000000..e4a3c7b --- /dev/null +++ b/truthfuldockprefs/Resources/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + TruthfulDockPrefs + CFBundleIdentifier + com.exoticswingset.truthfuldockprefs + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSPrincipalClass + TDPRootListController + + diff --git a/truthfuldockprefs/Resources/Root.plist b/truthfuldockprefs/Resources/Root.plist new file mode 100644 index 0000000..394c3aa --- /dev/null +++ b/truthfuldockprefs/Resources/Root.plist @@ -0,0 +1,93 @@ + + + + + items + + + cell + PSGroupCell + label + General + + + + cell + PSSwitchCell + default + + defaults + com.exoticswingset.truthfuldockprefs + key + isTweakEnabled + label + Enabled + + + + cell + PSGroupCell + label + Classic Dock (for notched devices) + + + + cell + PSSwitchCell + default + + defaults + com.exoticswingset.truthfuldockprefs + key + classicDockEnabled + label + Enabled + + + + cell + PSGroupCell + label + Custom Dock Opacity + + + + cell + PSSliderCell + default + 0 + defaults + com.exoticswingset.truthfuldockprefs + key + alphaValue + min + 0 + max> + 1 + showValue + + label + Set Dock Opacity + + + + cell + PSGroupCell + label + Save Settings + + + + cell + PSButtonCell + label + Respring + action + respring + + + + title + TruthfulDock + + diff --git a/truthfuldockprefs/TDPRootListController.h b/truthfuldockprefs/TDPRootListController.h new file mode 100644 index 0000000..478fbdf --- /dev/null +++ b/truthfuldockprefs/TDPRootListController.h @@ -0,0 +1,5 @@ +#import + +@interface TDPRootListController : PSListController + +@end diff --git a/truthfuldockprefs/TDPRootListController.m b/truthfuldockprefs/TDPRootListController.m new file mode 100644 index 0000000..7a97e0a --- /dev/null +++ b/truthfuldockprefs/TDPRootListController.m @@ -0,0 +1,23 @@ +#include "TDPRootListController.h" +#import + +@implementation TDPRootListController + +- (NSArray *)specifiers { + if (!_specifiers) { + _specifiers = [self loadSpecifiersFromPlistName:@"Root" target:self]; + } + + return _specifiers; +} + +- (void)respring +{ +pid_t pid; +int status; +const char* args[] = {"killall", "-9", "backboardd", NULL}; +posix_spawn(&pid, "/usr/bin/killall", NULL, NULL, (char* const*)args, NULL); +waitpid(pid, &status, WEXITED); +} + +@end diff --git a/truthfuldockprefs/entry.plist b/truthfuldockprefs/entry.plist new file mode 100644 index 0000000..d033770 --- /dev/null +++ b/truthfuldockprefs/entry.plist @@ -0,0 +1,21 @@ + + + + + entry + + bundle + TruthfulDockPrefs + cell + PSLinkCell + detail + TDPRootListController + icon + icon.png + isController + + label + TruthfulDockPrefs + + +