# weibo code
新版本Weibo
[Image: https://quip.com/-/blob/3fcZuQjOv8SjSESIyd_d6A]
```
expand == true
cy# [[UIApp keyWindow] recursiveDescription]
@"; layer = >
| >
| | >
| | | >
| | | | ; layer = >
| | | | | >
| | | | | | >
| | | | | | | >
| | | | | | | | >
| | | | | | | | >
| | | | | | | | | ; layer = ; contentOffset: {0, 12068.5}; contentInset = {64, 0, 0, 0}; contentSize = {320, 50584}>
| | | | | | | | | | >
| | | | | | | | | | | >
| | | | | | | | | | | | ; layer = ; contentOffset: {0, 0}>
cy# view =#0x1661e800
#"; layer = ; contentOffset: {0, 12068.5}; contentInset = {64, 0, 0, 0}; contentSize = {320, 50584}>"
cy# [view dataSource]
#""
分析在下面的下面呢!!!!!!!!!!!!!!
cy# view =#0x1661e800
#"; layer = ; contentOffset: {0, 12068.5}; contentInset = {64, 0, 0, 0}; contentSize = {320, 50584}>"
cy# [view dataSource]
#""
cy# controller = #0x16581000
#""
cy# [controller prlmWrapper]
#""
cy# prilmWrapper = #0x172bbda0
cy# [prilmWrapper tableView]
#"; layer = ; contentOffset: {0, 12068.5}; contentInset = {64, 0, 0, 0}; contentSize = {320, 50584}>"
```
[[prilmWrapper.delegate] respondsToSelector:@selector(showHeaderWhenRefresh:)]
WBMessagesTableViewController → MMSingleMessageViewController
{
- (void)viewDidLoad;
}
->>
MMBaseMessageViewController
{
- (void)scrollViewDidEndDragging:(id)arg1 willDecelerate:(_Bool)arg2;
- (_Bool)scrollViewShouldScrollToTop:(id)arg1;
- (void)scrollViewWillBeginDragging:(id)arg1;
- (void)scrollViewDidScroll:(id)arg1;
@property(retain, nonatomic) NSNumber *isScrollToBottom; // @synthesize isScrollToBottom=_isScrollToBottom;
- (void)viewDidLoad;
- (void)loadView;
}
实际操作过新浪微博iOS客户端的朋友就会知道,当上滑并松手时,才会“加载更多”。
这个操作在UIScrollViewDelegate中的触发函数是scrollViewDidEndDragging:willDecelerate:
分析 Mach-O 文件: [MMBaseMessageViewController scrollViewDidEndDragging:willDecelerate]
->>
[[MMBaseMessageViewController prlmWrapper] scrollViewDidEndDragging:willDecelerate]
接着 [MMBaseMessageViewController prlmWrapper]
->>
WBMessagePRLMTableViewWrapper *_prlmWrapper;
->>
@interface WBMessagePRLMTableViewWrapper : WBPRLMTableViewWrapper
->>
WBPRLMTableViewWrapper : PRLMTableViewWrapper
{
- (void)scrollViewDidEndDragging:(id)arg1 willDecelerate:(_Bool)arg2;
- (_Bool)scrollViewShouldScrollToTop:(id)arg1;
- (void)scrollViewWillBeginDragging:(id)arg1;
- (void)scrollViewDidScroll:(id)arg1;
}
->
WBMessagePRLMTableViewWrapper scrollViewDidEndDragging:willDecelerate
->
WBPRLMTableViewController.prlmWrapper
->
WBPRLMTableViewWrapper *prlmWrapper;
PRLMTableViewWrapper
{
- (void)scrollViewDidEndDragging:(id)arg1;
- (void)scrollViewDidScroll:(id)arg1;
}
[Image: https://quip.com/-/blob/INPoDbnlPrILy2ibFYNxrg]
```
__text:000000010093DF94 ; void __cdecl -[PRLMTableViewWrapper scrollViewDidEndDragging:](struct PRLMTableViewWrapper *self, SEL, id)
__text:000000010093DF94 __PRLMTableViewWrapper_scrollViewDidEndDragging__
__text:000000010093DF94 ; DATA XREF: __objc_const:00000001017AB128o
__text:000000010093DF94
__text:000000010093DF94 var_40 = -0x40
__text:000000010093DF94 var_30 = -0x30
__text:000000010093DF94 var_20 = -0x20
__text:000000010093DF94 var_10 = -0x10
__text:000000010093DF94
__text:000000010093DF94 STP D9, D8, [SP,#var_40]!
__text:000000010093DF98 STP X22, X21, [SP,#0x40+var_30]
__text:000000010093DF9C STP X20, X19, [SP,#0x40+var_20]
__text:000000010093DFA0 STP X29, X30, [SP,#0x40+var_10]
__text:000000010093DFA4 ADD X29, SP, #0x40+var_10
__text:000000010093DFA8 MOV X21, X2
__text:000000010093DFAC MOV X19, X0
__text:000000010093DFB0 ADRP X8, #selRef_tableView@PAGE
__text:000000010093DFB4 NOP
__text:000000010093DFB8 LDR X20, [X8,#selRef_tableView@PAGEOFF]
__text:000000010093DFBC MOV X1, X20
__text:000000010093DFC0 BL _objc_msgSend ; [PRLMTableViewWrapper tableView]
__text:000000010093DFC4 CMP X0, X21
__text:000000010093DFC8 B.NE loc_10093E134
```
[Image: https://quip.com/-/blob/uvJ0lU0nGQKMTMdMBRl9pA]最后推断函数是
[PRLMTableViewWrapper triggerLoadMore] 是更新函数
分析发包函数
-[MMInputManager sendButtonPressed:]
-(void)sendButtonPressed:(id)pressed;
->
[MMMessageUtility sendNewMessageWithText:inChat:callBack:]
+(void)sendNewMessageWithText:(id)text inChat:(id)chat callBack:(id)back;
->
→ MMBaseMessageViewController
{
-(void)sendImageMessages:(id)messages;
-(void)sendMessage:(id)message forward:(BOOL)forward;
}
最后推断
%hook MMMessageUtility
+(void)sendNewMessageWithText:(id)text inChat:(id)chat callBack:(id)back
{
//text 本次消息的内容
//inChat 之前的消息结构体
%orig;NSLog(@"~~~~~~~~~~~~~~~~today2");
//NSLog(@"text=%@",text);
NSLog(@"chat=%@",chat);
NSLog(@"back=%@",back);
}
%hook PRLMTableViewWrapper
-(void)triggerLoadMore 刷新得到数据
{
%orig;
NSLog(@"~~~~~~~~~~~~~~~~today4");
}
%end
继续 分析 triggerLoadMore 函数 发现是同步 应该就是它了
[Image: https://quip.com/-/blob/e6_y3P7e8VCl59Hv4GXNLg]