From 198eb03bb454659a44a9626ca4ad23caeace299b Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 14 Aug 2009 07:11:17 +0000 Subject: [PATCH] I never should have supported SMSBackground. --- Library.mm | 73 +++++++++++++++++++++++++++++++++++++++++++++++++----- control | 2 +- 2 files changed, 68 insertions(+), 7 deletions(-) diff --git a/Library.mm b/Library.mm index 9eeef2f..b7fb754 100644 --- a/Library.mm +++ b/Library.mm @@ -98,6 +98,8 @@ bool _itv; #import +#import + extern "C" void __clear_cache (char *beg, char *end); @protocol WinterBoard @@ -114,7 +116,10 @@ Class $UIImage; Class $UINavigationBar; Class $UIToolbar; +Class $CKMessageCell; +Class $CKTimestampView; Class $CKTranscriptController; +Class $CKTranscriptTableView; Class $SBApplication; Class $SBApplicationIcon; @@ -230,6 +235,8 @@ static NSString *$pathForFile$inBundle$(NSString *file, NSBundle *bundle, bool u [names addObject:[NSString stringWithFormat:@"%@.png", newname]]; \ if (identifier == nil); + else if ([identifier isEqualToString:@"com.apple.chatkit"]) + [names addObject:[NSString stringWithFormat:@"Bundles/com.apple.MobileSMS/%@", file]]; else if ([identifier isEqualToString:@"com.apple.calculator"]) [names addObject:[NSString stringWithFormat:@"Files/Applications/Calculator.app/%@", file]]; else if (![identifier isEqualToString:@"com.apple.springboard"]); @@ -341,7 +348,7 @@ void WBLogRect(const char *tag, struct CGRect rect) { void WBLogHierarchy(UIView *view, unsigned index = 0, unsigned indent = 0) { CGRect frame([view frame]); - NSLog(@"%*s|%2d:%s : {%f,%f+%f,%f} (%@)", indent * 3, "", index, class_getName([view class]), frame.origin.x, frame.origin.y, frame.size.width, frame.size.height, [view backgroundColor]); + NSLog(@"%*s|%2d:%p:%s : {%f,%f+%f,%f} (%@)", indent * 3, "", index, view, class_getName([view class]), frame.origin.x, frame.origin.y, frame.size.width, frame.size.height, [view backgroundColor]); index = 0; for (UIView *child in [view subviews]) WBLogHierarchy(child, index++, indent + 1); @@ -1021,6 +1028,7 @@ MSHook(void, SBStatusBarTimeView$drawRect$, SBStatusBarTimeView *self, SEL sel, @interface UIView (WinterBoard) - (bool) wb$isWBImageView; +- (void) wb$logHierarchy; @end @implementation UIView (WinterBoard) @@ -1029,6 +1037,10 @@ MSHook(void, SBStatusBarTimeView$drawRect$, SBStatusBarTimeView *self, SEL sel, return false; } +- (void) wb$logHierarchy { + WBLogHierarchy(self); +} + @end @interface WBImageView : UIImageView { @@ -1196,6 +1208,35 @@ MSHook(void, SBIconLabel$drawRect$, SBIconLabel *self, SEL sel, CGRect rect) { [label drawAtPoint:CGPointMake((bounds.size.width - size.width) / 2, 0) withStyle:style]; } +MSHook(void, CKMessageCell$addBalloonView$, id self, SEL sel, CKBalloonView *balloon) { + _CKMessageCell$addBalloonView$(self, sel, balloon); + [balloon setBackgroundColor:[UIColor clearColor]]; +} + +MSHook(id, CKMessageCell$initWithStyle$reuseIdentifier$, id self, SEL sel, int style, NSString *reuse) { + if ((self = _CKMessageCell$initWithStyle$reuseIdentifier$(self, sel, style, reuse)) != nil) { + [[self contentView] setBackgroundColor:[UIColor clearColor]]; + } return self; +} + +MSHook(id, CKTimestampView$initWithStyle$reuseIdentifier$, id self, SEL sel, int style, NSString *reuse) { + if ((self = _CKTimestampView$initWithStyle$reuseIdentifier$(self, sel, style, reuse)) != nil) { + UILabel *&_label(MSHookIvar(self, "_label")); + [_label setBackgroundColor:[UIColor clearColor]]; + } return self; +} + +MSHook(void, CKTranscriptTableView$setSeparatorStyle$, id self, SEL sel, int style) { + _CKTranscriptTableView$setSeparatorStyle$(self, sel, UITableViewCellSeparatorStyleNone); +} + +MSHook(id, CKTranscriptTableView$initWithFrame$style$, id self, SEL sel, CGRect frame, int style) { + _trace(); + if ((self = _CKTranscriptTableView$initWithFrame$style$(self, sel, frame, style)) != nil) { + [self setSeparatorStyle:UITableViewCellSeparatorStyleNone]; + } return self; +} + MSHook(void, TranscriptController$loadView, mSMSMessageTranscriptController *self, SEL sel) { _TranscriptController$loadView(self, sel); @@ -1224,6 +1265,8 @@ MSHook(void, TranscriptController$loadView, mSMSMessageTranscriptController *sel } WBLogHierarchy(placard); + + [placard performSelector:@selector(wb$logHierarchy) withObject:nil afterDelay:10]; } } @@ -1467,13 +1510,31 @@ extern "C" void WBInitialize() { [Info_ setObject:[info objectForKey:key] forKey:key]; } - $CKTranscriptController = objc_getClass("CKTranscriptController"); - _TranscriptController$loadView = MSHookMessage($CKTranscriptController, @selector(loadView), &$TranscriptController$loadView); + bool sms($getTheme$([NSArray arrayWithObjects:@"SMSBackground.png", @"SMSBackground.jpg", nil]) != nil); + + if ([NSBundle bundleWithIdentifier:@"com.apple.chatkit"]) + if (sms) { + $CKMessageCell = objc_getClass("CKMessageCell"); + _CKMessageCell$addBalloonView$ = MSHookMessage($CKMessageCell, @selector(addBalloonView:), &$CKMessageCell$addBalloonView$); + _CKMessageCell$initWithStyle$reuseIdentifier$ = MSHookMessage($CKMessageCell, @selector(initWithStyle:reuseIdentifier:), &$CKMessageCell$initWithStyle$reuseIdentifier$); + + $CKTranscriptTableView = objc_getClass("CKTranscriptTableView"); + _CKTranscriptTableView$setSeparatorStyle$ = MSHookMessage($CKTranscriptTableView, @selector(setSeparatorStyle:), &$CKTranscriptTableView$setSeparatorStyle$); + _CKTranscriptTableView$initWithFrame$style$ = MSHookMessage($CKTranscriptTableView, @selector(initWithFrame:style:), &$CKTranscriptTableView$initWithFrame$style$); + + $CKTimestampView = objc_getClass("CKTimestampView"); + _CKTimestampView$initWithStyle$reuseIdentifier$ = MSHookMessage($CKTimestampView, @selector(initWithStyle:reuseIdentifier:), &$CKTimestampView$initWithStyle$reuseIdentifier$); + + $CKTranscriptController = objc_getClass("CKTranscriptController"); + _TranscriptController$loadView = MSHookMessage($CKTranscriptController, @selector(loadView), &$TranscriptController$loadView); + } if ([identifier isEqualToString:@"com.apple.MobileSMS"]) { - if (_TranscriptController$loadView == NULL) { - Class mSMSMessageTranscriptController = objc_getClass("mSMSMessageTranscriptController"); - _TranscriptController$loadView = MSHookMessage(mSMSMessageTranscriptController, @selector(loadView), &$TranscriptController$loadView); + if (sms) { + if (_TranscriptController$loadView == NULL) { + Class mSMSMessageTranscriptController = objc_getClass("mSMSMessageTranscriptController"); + _TranscriptController$loadView = MSHookMessage(mSMSMessageTranscriptController, @selector(loadView), &$TranscriptController$loadView); + } } } else if ([identifier isEqualToString:@"com.apple.springboard"]) { CFNotificationCenterAddObserver( diff --git a/control b/control index ba131f9..63c2917 100644 --- a/control +++ b/control @@ -3,7 +3,7 @@ Priority: optional Section: System Maintainer: Jay Freeman (saurik) Architecture: iphoneos-arm -Version: 0.9.2983-2 +Version: 0.9.2990-1 Description: more powerful, open-source SummerBoard Name: WinterBoard Depends: mobilesubstrate (>= 0.9.2958-1), killall -- 2.45.2