Skip to content

Commit

Permalink
Add a process blacklist and make minimum iOS 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
acquitelol committed Jun 25, 2024
1 parent ff397b7 commit e905895
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
export ARCHS = arm64 arm64e

THEOS_PACKAGE_SCHEME = rootless
TARGET := iphone:clang:latest:14.0
SUBPROJECTS = Tweak Preferences
FINALPACKAGE = 1
# FINALPACKAGE = 1

include $(THEOS)/makefiles/common.mk
include $(THEOS_MAKE_PATH)/aggregate.mk
include $(THEOS_MAKE_PATH)/aggregate.mk
31 changes: 30 additions & 1 deletion Tweak/Flora.x
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@

NSUserDefaults *preferences;

// Suggested by jan (@yandevelop)
static BOOL shouldExecute() {
NSArray *args = [[NSClassFromString(@"NSProcessInfo") processInfo] arguments];

if (args.count == 0) {
NSLog(@"[Flora] Skipping empty process arguments");
return NO;
}

NSString *executablePath = args.firstObject;
NSString *processName = [executablePath lastPathComponent];

if (executablePath && processName) {
BOOL isApplication = [executablePath containsString:@"/Application/"]
|| [executablePath containsString:@"/Applications/"]
|| [processName isEqualToString:@"SpringBoard"]; // SpringBoard is not an app however we want to include it
BOOL isFileProvider = [[processName lowercaseString] containsString:@"fileprovider"];
NSArray *skipList = @[@"AdSheet", @"CoreAuthUI", @"InCallService", @"MessagesNotificationViewService"];

if (!isFileProvider && isApplication && ![skipList containsObject:processName] && ![executablePath containsString:@".appex/"]) {
return YES;
}
}

NSLog(@"[Flora] Skipping '%@'", executablePath);
return NO;
}

static void init_preferences() {
// We first get the extended preference plist
int result = libSandy_applyProfile("Flora_Preferences");
Expand Down Expand Up @@ -156,8 +184,9 @@ static UIColor *getBubbleColor(NSString *type) {
id enabledObject = [preferences objectForKey:@"enabled"];
[preferences setObject:enabledObject forKey:@"staticEnabled"];
BOOL isEnabled = [preferences boolForKey:@"staticEnabled"];
BOOL isValidContext = shouldExecute();

if (!isEnabled) {
if (!isEnabled || !isValidContext) {
NSLog(@"[Flora] Tweak is disabled. Exiting...");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Tweak/Utilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,4 @@ + (NSData *)decompressData:(NSData *)compressedData {
return decompressedData;
}

@end
@end
4 changes: 2 additions & 2 deletions control
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Package: com.rosiepie.flora
Name: Flora
Version: 1.1.4
Version: 1.1.5
Architecture: iphoneos-arm
Description: A modern color changer, built for today's jailbreaks.
Maintainer: Rosie
Author: Rosie
Section: Tweaks
Depends: firmware (>= 14.0), mobilesubstrate (>= 0.9.5000), preferenceloader (>= 2.2.3), com.mrgcgamer.libgcuniversal, com.opa334.libsandy
Depends: firmware (>= 15.0), mobilesubstrate (>= 0.9.5000), preferenceloader (>= 2.2.3), com.mrgcgamer.libgcuniversal, com.opa334.libsandy
Icon: https://raw.githubusercontent.com/acquitelol/flora/1.0.3/Preferences/Resources/FullIcon.png

0 comments on commit e905895

Please sign in to comment.