Created
March 5, 2019 19:33
-
-
Save jakeajames/9c8890b20b69af585e66b30a501e6084 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface _UIBackdropView : UIView | |
-(id)initWithStyle:(long long)style; | |
-(long long)style; | |
@end | |
@interface SBFloatingDockPlatterView | |
@property (nonatomic, retain) _UIBackdropView * backgroundView; | |
@end | |
@interface SBFolderBackgroundView : UIView | |
@end | |
@interface SBWallpaperEffectView : UIView | |
-(id)initWithWallpaperVariant:(long long)variant; | |
-(void)setStyle:(long long)style; | |
@end | |
@interface SBFolderIconBackgroundView : UIView | |
-(void)setBlurring:(BOOL)bl; | |
@property (nonatomic, retain) UIView *darkWallView; | |
@end | |
@interface UIDeviceWhiteColor : UIColor | |
-(id)initWithCGColor:(CGColorRef)color; | |
@end | |
@interface MTMaterialView : UIView | |
@end | |
@interface UIColor (tweak) | |
@property (nonatomic, readonly) CGFloat alpha; | |
@property (nonatomic, readonly) CGFloat red; | |
@property (nonatomic, readonly) CGFloat green; | |
@property (nonatomic, readonly) CGFloat blue; | |
@end | |
@interface PLPlatterHeaderContentView | |
@property (nonatomic, retain) UIButton *utilityButton; | |
@end | |
@interface NCNotificationContentView : UIView | |
@property (setter=_setPrimaryLabel:, getter=_primaryLabel, nonatomic, retain) UILabel *primaryLabel; | |
@property (getter=_secondaryLabel, nonatomic, readonly) UILabel *secondaryLabel; | |
@property (setter=_setPrimarySubtitleLabel:, getter=_primarySubtitleLabel, nonatomic, retain) UILabel *primarySubtitleLabel; | |
@end | |
@interface SBUIActionView : UIView | |
@end | |
// SpringBoard hooks | |
%group SB | |
%hook UIColor | |
// initially this method was there, but once eclipse preview expired it wasn't anymore and i was safe-moding. apparently it was added by that? | |
%new | |
-(double)alpha { | |
CGFloat red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0; | |
[self getRed:&red green:&green blue:&blue alpha:&alpha]; | |
return alpha; | |
} | |
%end | |
%hook SBFloatingDockPlatterView | |
-(void)layoutSubviews { | |
%orig; | |
if ([self.backgroundView style] != 2030) [self.backgroundView initWithStyle:2030]; | |
} | |
%end | |
static UIDeviceWhiteColor *cc = nil; | |
%hook SBFolderBackgroundView | |
/*does not work anymore: | |
-(void)layoutSubviews { | |
%orig; | |
self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.7]; | |
} | |
*/ | |
-(UIDeviceWhiteColor *)_tintViewBackgroundColorAtFullAlpha { | |
if (cc) return cc; | |
cc = [[%c(UIDeviceWhiteColor) alloc] initWithCGColor:[UIColor colorWithWhite:0 alpha:0.7].CGColor]; | |
return cc; | |
} | |
%end | |
// this is the folder icon | |
%hook SBFolderIconBackgroundView | |
// add a new property to keep track of whether we already added this or not | |
%property (nonatomic, retain) UIView *darkWallView; | |
-(void)setWallpaperBackgroundRect:(CGRect)rect forContents:(CGImageRef)cnt withFallbackColor:(CGColorRef)color { | |
if (!self.darkWallView) { | |
// create a new wallpaper effect view. this is a "fake" effect view, meaning there are no real effects, but a cached image of the blurred wallpaper. this makes performance not suck | |
self.darkWallView = (SBWallpaperEffectView *)[[%c(SBWallpaperEffectView) alloc] initWithWallpaperVariant:1]; | |
[(SBWallpaperEffectView *)self.darkWallView setStyle:14]; // 14 means "dark tint" | |
[(SBWallpaperEffectView *)self.darkWallView setFrame:self.bounds]; // same size as folder | |
[(SBWallpaperEffectView *)self.darkWallView autorelease]; // ARC is disabled, thus, do this | |
[self addSubview:(SBWallpaperEffectView *)self.darkWallView]; // add | |
} | |
%orig; | |
} | |
%end | |
// widgets | |
%hook WGWidgetPlatterView | |
-(void)layoutSubviews { | |
%orig; | |
// invert white to black but keep alpha | |
[MSHookIvar<MTMaterialView *>(self, "_mainOverlayView") setBackgroundColor:[UIColor colorWithWhite:0 alpha: MSHookIvar<MTMaterialView *>(self, "_mainOverlayView").backgroundColor.alpha]]; // main view | |
[MSHookIvar<MTMaterialView *>(self, "_headerOverlayView") setBackgroundColor:[UIColor colorWithWhite:0 alpha: MSHookIvar<MTMaterialView *>(self, "_headerOverlayView").backgroundColor.alpha]]; // header (top) of widget | |
} | |
%end | |
// the rest of MTMaterialViews (notifications etc...) | |
%hook MTMaterialView | |
-(void)setBackgroundColor:(UIColor*)color { | |
// invert white to black | |
%orig([UIColor colorWithWhite:0 alpha:color.alpha]); | |
} | |
%end | |
// notification & widgets stuff | |
%hook PLPlatterHeaderContentView | |
-(void)layoutSubviews { | |
%orig; | |
if (MSHookIvar<UILabel *>(self, "_titleLabel").layer.filters.count) MSHookIvar<UILabel *>(self, "_titleLabel").layer.filters = nil; | |
MSHookIvar<UILabel *>(self, "_titleLabel").textColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
if (MSHookIvar<UILabel *>(self, "_dateLabel").layer.filters.count) MSHookIvar<UILabel *>(self, "_dateLabel").layer.filters = nil; | |
MSHookIvar<UILabel *>(self, "_dateLabel").textColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
if (self.utilityButton.titleLabel.layer.filters.count) self.utilityButton.titleLabel.layer.filters = nil; | |
self.utilityButton.titleLabel.textColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
} | |
%end | |
%hook NCNotificationListCellActionButton | |
-(void)layoutSubviews { | |
%orig; | |
if (MSHookIvar<UILabel *>(self, "_titleLabel").layer.filters.count) MSHookIvar<UILabel *>(self, "_titleLabel").layer.filters = nil; | |
MSHookIvar<UILabel *>(self, "_titleLabel").textColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
} | |
%end | |
%hook NCNotificationContentView | |
-(void)layoutSubviews { | |
%orig; | |
if (self.primaryLabel.layer.filters.count) self.primaryLabel.layer.filters = nil; | |
self.primaryLabel.textColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
if (self.secondaryLabel.layer.filters.count) self.secondaryLabel.layer.filters = nil; | |
self.secondaryLabel.textColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
if (self.primarySubtitleLabel.layer.filters.count) self.primarySubtitleLabel.layer.filters = nil; | |
self.primarySubtitleLabel.textColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
MSHookIvar<UITextView *>(self, "_secondaryTextView").textColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
// is white | |
if (self.backgroundColor.red == 1 && self.backgroundColor.green == 1 && self.backgroundColor.blue == 1) self.backgroundColor = [UIColor blackColor]; | |
} | |
%end | |
%hook NCNotificationLongLookView | |
-(void)layoutSubviews { | |
%orig; | |
MSHookIvar<UIView *>(self, "_mainContentView").backgroundColor = [UIColor blackColor]; | |
} | |
%end | |
%hook NCToggleControl | |
-(void)layoutSubviews { | |
%orig; | |
if (MSHookIvar<UILabel *>(self, "_titleLabel").layer.filters.count) MSHookIvar<UILabel *>(self, "_titleLabel").layer.filters = nil; | |
MSHookIvar<UILabel *>(self, "_titleLabel").textColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
if (MSHookIvar<UIImageView*>(self, "_glyphView").layer.filters.count) MSHookIvar<UIImageView*>(self, "_glyphView").layer.filters = nil; | |
MSHookIvar<UIImageView*>(self, "_glyphView").tintColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
} | |
%end | |
%hook BSUIEmojiLabelView | |
-(void)layoutSubviews { | |
%orig; | |
if (MSHookIvar<UILabel *>(self, "_contentLabel").layer.filters.count) MSHookIvar<UILabel *>(self, "_contentLabel").layer.filters = nil; | |
MSHookIvar<UILabel *>(self, "_contentLabel").textColor = [UIColor colorWithWhite:1 alpha:0.7]; | |
} | |
%end | |
%hook SBUIActionView | |
-(void)layoutSubviews { | |
%orig; | |
self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.72]; | |
if (MSHookIvar<UIImageView*>(self, "_imageView").layer.filters.count) MSHookIvar<UIImageView*>(self, "_imageView").layer.filters = nil; | |
MSHookIvar<UIImageView*>(self, "_imageView").tintColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
} | |
-(void)setBackgroundColor:(UIColor *)color { | |
%orig([UIColor colorWithWhite:0 alpha:0.72]); | |
} | |
%end | |
%hook SBUIActionViewLabel | |
-(void)layoutSubviews { | |
%orig; | |
if (MSHookIvar<UILabel *>(self, "_label").layer.filters.count) MSHookIvar<UILabel *>(self, "_label").layer.filters = nil; | |
MSHookIvar<UILabel *>(self, "_label").textColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
} | |
%end | |
%hook PLExpandedPlatterHeaderContentView | |
-(void)setBackgroundColor:(UIColor *)color { | |
%orig([UIColor blackColor]); | |
} | |
%end | |
%end | |
// widgets are own processes and the stuff on SB are just remote controllers :( | |
// a LOT lacking here since FLEX can't inject and I'd probably have to reverse or wait for cycript | |
%group WG | |
%hook UILabel | |
-(void)layoutSubviews { | |
%orig; | |
if (self.layer.filters.count) self.layer.filters = nil; | |
self.textColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
} | |
%end | |
%hook UITextView | |
-(void)layoutSubviews { | |
%orig; | |
if (self.layer.filters.count) self.layer.filters = nil; | |
self.textColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
} | |
%end | |
%hook SBIconView | |
-(BOOL)hidden { | |
return true; | |
} | |
-(void)setHidden:(BOOL)arg1 { | |
%orig(true); | |
} | |
%end | |
%hook UIButton | |
-(void)layoutSubviews { | |
%orig; | |
if (self.titleLabel.layer.filters.count) self.layer.filters = nil; | |
self.titleLabel.textColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
} | |
%end | |
%hook UIImageView | |
-(void)layoutSubviews { | |
%orig; | |
if (self.layer.filters.count) self.layer.filters = nil; | |
self.tintColor = [UIColor colorWithWhite:1 alpha:0.8]; | |
} | |
%end | |
%end | |
// check what to hook | |
%ctor { | |
if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.springboard"]) { | |
%init(SB); | |
return; | |
} | |
id value = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"NSExtension"]; | |
if (value) { | |
value = [[[[NSBundle mainBundle] infoDictionary] valueForKey:@"NSExtension"] valueForKey:@"NSExtensionPointIdentifier"]; | |
if (value) { | |
if ([value isEqualToString:@"com.apple.widget-extension"]) %init(WG); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment