From: Jay Freeman (saurik) Date: Thu, 20 Sep 2012 21:46:29 +0000 (+0000) Subject: Support text theming of icon badge labels on iOS 6. X-Git-Tag: v0.9.3906~3 X-Git-Url: https://git.saurik.com/winterboard.git/commitdiff_plain/c40f4c119a37f0ce071b3253dc6ef89a6dfe28d8?hp=139d903ff10b83da720c9e707585c1a05754ad10 Support text theming of icon badge labels on iOS 6. --- diff --git a/Library.mm b/Library.mm index 6834da0..2744675 100644 --- a/Library.mm +++ b/Library.mm @@ -145,8 +145,11 @@ MSClassHook(SBCalendarApplicationIcon) MSClassHook(SBCalendarIconContentsView) MSClassHook(SBDockIconListView) MSClassHook(SBIcon) +MSClassHook(SBIconAccessoryImage) +MSMetaClassHook(SBIconAccessoryImage) MSClassHook(SBIconBadge) MSClassHook(SBIconBadgeFactory) +MSClassHook(SBIconBadgeImage) MSClassHook(SBIconContentView) MSClassHook(SBIconController) MSClassHook(SBIconLabel) @@ -184,6 +187,10 @@ static struct MSFixClass { MSFixClass() { static bool IsWild_; static bool Four_($SBDockIconListView != nil); +@interface NSObject (wb$SBIconAccessoryImage) ++ (Class) _imageClassForIcon:(SBIcon *)icon location:(int)location; +@end + @interface NSDictionary (WinterBoard) - (UIColor *) wb$colorForKey:(NSString *)key; - (BOOL) wb$boolForKey:(NSString *)key; @@ -882,6 +889,21 @@ MSInstanceMessageHook1(CGSize, NSString, sizeWithFont, UIFont *, font) { return [self sizeWithStyle:[NSString stringWithFormat:@"%@;%@;%@;%@", [font markupDescription], WBColorMarkup(), base, info] forWidth:65535]; } +MSClassMessageHook2(UIImage *, SBIconAccessoryImage, checkoutAccessoryImageForIcon,location, id, icon, int, location) { + if ([self _imageClassForIcon:icon location:location] != $SBIconBadgeImage) + return MSOldCall(icon, location); + + WBStringDrawingState badgeState = {NULL, -1, @"" + , @"BadgeStyle"}; + + stringDrawingState_ = &badgeState; + + UIImage *image(MSOldCall(icon, location)); + + stringDrawingState_ = NULL; + return image; +} + MSInstanceMessageHook1(UIImage *, SBIconBadgeFactory, checkoutBadgeImageForText, NSString *, text) { WBStringDrawingState badgeState = {NULL, -1, @"" , @"BadgeStyle"};