Skip to content
This repository was archived by the owner on Dec 24, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d10090b
support for simject
brendonjkding Nov 28, 2020
60a44e7
fix alpha always 0 on 32bit ios7 device
brendonjkding Oct 21, 2020
d18050d
fix building
brendonjkding Nov 12, 2020
b4cf8d8
make compiling friendly to 11.2 sdk
brendonjkding Nov 23, 2020
688ccb8
fix fallback color always 1 alpha
brendonjkding Oct 21, 2020
f9e5d83
see detail
brendonjkding Nov 24, 2020
346d003
fully use arc
brendonjkding Nov 26, 2020
6c5c54c
major clean-up
brendonjkding Nov 27, 2020
dd0a7e0
fix issues on iOS 10
brendonjkding Dec 2, 2020
ca8daee
after-install should not be the target when running make
brendonjkding Dec 2, 2020
bf2e13b
add x86_64 to libcolorpicker.tbd in theos/vendor/lib is enough for li…
brendonjkding Dec 2, 2020
cac8d22
fix building with sdk > 13.0
brendonjkding Dec 2, 2020
d753381
do not set value if the value have not changed
brendonjkding Dec 23, 2020
2b90b4c
set specifier in reloadWithSpecifier:
brendonjkding Dec 23, 2020
ac883fb
typo?
brendonjkding Dec 24, 2020
c745622
"rootless" simulator version
brendonjkding Dec 27, 2020
803fea0
HBColorPickerTableCell compatibility
brendonjkding Jan 2, 2021
8486e89
Update README.md
brendonjkding Jan 2, 2021
8d9bb6a
adapt to my theos fork
brendonjkding Mar 20, 2021
06999b4
Prevent potential bug
brendonjkding Mar 21, 2021
b73ec36
Remove reliance on locatesim.mk
brendonjkding Mar 21, 2021
a885d28
Use latest sdk
brendonjkding May 15, 2021
93c10ea
Fix building with latest sdk
brendonjkding Aug 29, 2021
bc62ee2
Adapt to my fork of theos
brendonjkding May 29, 2022
8fa94eb
Support pure rootless env
brendonjkding May 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
20 changes: 0 additions & 20 deletions ColorPicker.h

This file was deleted.

40 changes: 23 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
ifdef DEBUG
ARCHS = arm64
TARGET = iphone:clang:11.2
ifdef SIMULATOR
TARGET = simulator:clang:latest:8.0
else
ARCHS = armv7 armv7s arm64 arm64e
TARGET = iphone:clang:9.2:6.0
TARGET = iphone:clang:latest:7.0
ifneq ($(debug),0)
ARCHS= arm64 arm64e
else
ARCHS= armv7 arm64 arm64e
endif
endif


include $(THEOS)/makefiles/common.mk

LIBRARY_NAME = libcolorpicker

$(LIBRARY_NAME)_FILES = libcolorpicker.mm UIColor+PFColor.m PFColorPicker.m PFColorTransparentView.m PFColorViewController.xm PFColorCell.mm PFColorAlert.m PFColorAlertViewController.xm PFHaloHueView.m PFHaloKnobView.m PFColorLitePreviewView.m PFColorLiteSlider.m PFLiteColorCell.mm PFSimpleLiteColorCell.mm PFColorPickerWelcome.mm
$(LIBRARY_NAME)_FRAMEWORKS = UIKit CoreGraphics Foundation Social Accounts
$(LIBRARY_NAME)_PRIVATE_FRAMEWORKS = Preferences
$(LIBRARY_NAME)_LDFLAGS += -Wl,-segalign,4000
$(LIBRARY_NAME)_CFLAGS = -fobjc-arc
PFColorAlert.m_CFLAGS = -fno-objc-arc
PFSimpleLiteColorCell.mm_CFLAGS = -fno-objc-arc
PFLiteColorCell.mm_CFLAGS = -fno-objc-arc
libcolorpicker_FILES = libcolorpicker.mm UIColor+PFColor.m PFColorAlert.m PFColorAlertViewController.xm PFHaloHueView.m PFHaloKnobView.m PFColorLitePreviewView.m PFColorLiteSlider.m PFLiteColorCell.mm PFSimpleLiteColorCell.mm PFColorPickerWelcome.mm PFSimpleLiteColorCell_.mm
libcolorpicker_FRAMEWORKS = UIKit CoreGraphics Foundation Social Accounts
libcolorpicker_PRIVATE_FRAMEWORKS = Preferences
libcolorpicker_LDFLAGS += -Wl,-segalign,4000
libcolorpicker_CFLAGS = -fobjc-arc -Wno-error=deprecated-declarations
PFColorPickerWelcome.mm_CFLAGS = -Wno-deprecated-declarations

include $(THEOS)/makefiles/common.mk
include $(THEOS_MAKE_PATH)/library.mk

after-install::
install.exec "killall -9 Preferences"

include $(THEOS_MAKE_PATH)/library.mk
setup::
@[ -f $(SIMULATOR_ROOT)/usr/lib/$(LIBRARY_NAME).dylib ] || sudo ln -s /opt/simject/usr/lib/$(LIBRARY_NAME).dylib $(SIMULATOR_ROOT)/usr/lib/$(LIBRARY_NAME).dylib || true
@[ -f $(SIMULATOR_ROOT)/usr/lib/$(LIBRARY_NAME).dylib ] || echo -e "\x1b[1;35m>> warning: create symlink in $(SIMULATOR_ROOT)/usr/lib yourself if needed\x1b[m" || true

remove::
@sudo rm -f $(SIMULATOR_ROOT)/usr/lib/$(LIBRARY_NAME).dylib
32 changes: 8 additions & 24 deletions PFColorAlert.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ @interface PFColorAlert ()
@implementation PFColorAlert

+ (PFColorAlert *)colorAlertWithStartColor:(UIColor *)startColor showAlpha:(BOOL)showAlpha {
return [[[PFColorAlert alloc] initWithStartColor:startColor showAlpha:showAlpha] autorelease];
return [[PFColorAlert alloc] initWithStartColor:startColor showAlpha:showAlpha];
}

- (PFColorAlert *)initWithStartColor:(UIColor *)startColor showAlpha:(BOOL)showAlpha {
Expand All @@ -44,7 +44,7 @@ - (PFColorAlert *)initWithStartColor:(UIColor *)startColor showAlpha:(BOOL)showA
if (@available(iOS 13, *)) {
NSSet<UIScene *> *connectedScenes = [[UIApplication sharedApplication] connectedScenes];
UIScene *firstScene = [[connectedScenes allObjects] objectAtIndex:0];
self.darkeningWindow = [[UIWindow alloc] initWithWindowScene:firstScene];
self.darkeningWindow = [[UIWindow alloc] initWithWindowScene:(UIWindowScene*)firstScene];
self.darkeningWindow.frame = winFrame;
} else {
self.darkeningWindow = [[UIWindow alloc] initWithFrame:winFrame];
Expand All @@ -62,7 +62,7 @@ - (PFColorAlert *)initWithStartColor:(UIColor *)startColor showAlpha:(BOOL)showA
if (@available(iOS 13, *)) {
NSSet<UIScene *> *connectedScenes = [[UIApplication sharedApplication] connectedScenes];
UIScene *firstScene = [[connectedScenes allObjects] objectAtIndex:0];
self.popWindow = [[UIWindow alloc] initWithWindowScene:firstScene];
self.popWindow = [[UIWindow alloc] initWithWindowScene:(UIWindowScene*)firstScene];
self.popWindow.frame = winFrame;
} else {
self.popWindow = [[UIWindow alloc] initWithFrame:winFrame];
Expand All @@ -82,10 +82,10 @@ - (PFColorAlert *)initWithStartColor:(UIColor *)startColor showAlpha:(BOOL)showA
[self.darkeningWindow makeKeyAndVisible];

self.popWindow.rootViewController = self.mainViewController;
#ifndef DEBUG

self.darkeningWindow.windowLevel = UIWindowLevelAlert - 2;
self.popWindow.windowLevel = UIWindowLevelAlert - 1;
#endif

self.popWindow.backgroundColor = UIColor.clearColor;
self.popWindow.hidden = NO;
self.popWindow.alpha = 0.0f;
Expand Down Expand Up @@ -115,8 +115,6 @@ - (void)displayWithCompletion:(void (^)(UIColor *pickedColor))completionBlock {

self.completionBlock = completionBlock;

[self retain];

[self.popWindow makeKeyAndVisible];

[UIView animateWithDuration:0.3f animations:^{
Expand All @@ -128,13 +126,12 @@ - (void)displayWithCompletion:(void (^)(UIColor *pickedColor))completionBlock {
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(close)];
self.darkeningWindow.userInteractionEnabled = YES;
[self.darkeningWindow addGestureRecognizer:tapGesture];
[tapGesture release];

NSString *prefPath = @"/var/mobile/Library/Preferences/com.pixelfiredev.libcolorpicker.plist";
NSString *prefPath = @THEOS_PACKAGE_INSTALL_PREFIX"/var/mobile/Library/Preferences/com.pixelfiredev.libcolorpicker.plist";
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile:prefPath];

if (!dict)
dict = [[NSMutableDictionary new] autorelease];
dict = [NSMutableDictionary new] ;

NSString *kDidShow = @"didShowWelcomeScreen";
if (!dict[kDidShow]) {
Expand All @@ -161,11 +158,7 @@ - (void)displayWithCompletion:(void (^)(UIColor *pickedColor))completionBlock {
- (void)showWithStartColor:(UIColor *)startColor
showAlpha:(BOOL)showAlpha
completion:(void (^)(UIColor *pickedColor))completionBlock {
UIAlertView *deprecated = [[UIAlertView alloc] initWithTitle:@"libcolorpicker" message:@"Hey! It appears like this preference bundle is trying to use deprecated methods to invoke the color picker and requires an update. Please inform the dev of this tweak about it."
delegate:nil
cancelButtonTitle:nil
otherButtonTitles:@"OK", nil];
[deprecated show];

}

- (void)close {
Expand All @@ -185,13 +178,4 @@ - (void)close {
}];
}

- (void)dealloc {
[self.mainViewController release];
[self.popWindow release];
[self.darkeningWindow release];
self.completionBlock = nil;

[super dealloc];
}

@end
8 changes: 5 additions & 3 deletions PFColorAlertViewController.xm
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ typedef enum UIUserInterfaceStyle : NSInteger {
UIUserInterfaceStyleLight,
UIUserInterfaceStyleDark
} UIUserInterfaceStyle;
#elif __IPHONE_OS_VERSION_MAX_ALLOWED < 120000
#define UIUserInterfaceStyleDark 2
#endif

@interface UITraitCollection (iOS12_13)
@property (nonatomic, readonly) UIUserInterfaceStyle userInterfaceStyle;
@interface UITraitCollection_
@property (nonatomic, readonly) NSInteger userInterfaceStyle __TVOS_AVAILABLE(10_0) __WATCHOS_PROHIBITED; // unspecified: UIUserInterfaceStyleUnspecified
@end

@interface _UIBackdropViewSettings : NSObject
Expand All @@ -50,7 +52,7 @@ autosizesToFitSuperview:(BOOL)fitsSuperview
if (%c(_UIBackdropView)) {
int style = 2010;
if (@available(iOS 13, *)) {
if ([UIScreen mainScreen].traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
if (((UITraitCollection_*)[UIScreen mainScreen].traitCollection).userInterfaceStyle == UIUserInterfaceStyleDark) {
_tintColor = UIColor.whiteColor;
style = 1100;
}
Expand Down
73 changes: 0 additions & 73 deletions PFColorCell.mm

This file was deleted.

25 changes: 0 additions & 25 deletions PFColorPicker.h

This file was deleted.

Loading