@
protocol messageNodeViewDelegate <NSObject>
- (MMUIViewController *) getViewController;
@
end@
interface MMTextView : NSObject
{}
- (void)setText:(id)arg1;
@
end@
interface MMGrowTextView : NSObject
{
MMTextView *_textView;
}
- (void)postTextChangeNotification;
@
end@
interface WCNewCommitViewController:MMUIViewController
{
MMGrowTextView *_textView;
}
@
property(nonatomic) _Bool bCommmitOnlyText;
- (id)initWithImages:(id)arg1 contacts:(id)arg2;
@
end@
interface CMessageWrap:NSObject
{
NSString *m_nsContent;
unsigned int m_uiMessageType;
}
@
property(nonatomic) unsigned int m_uiMessageType;
@
property(retain, nonatomic) NSString *m_nsContent;
+ (id)getMsgImg:(id)arg1;
- (_Bool)IsImgMsg;
- (_Bool)IsTextMsg;
@
end@
interface BaseMessageNodeView : NSObject
{
CMessageWrap *m_oMessageWrap;
id <messageNodeViewDelegate> m_delegate;
}
- (id)m_msgWrap;
@
end@
interface MMImage : NSObject
{}
- (id)initWithImage:(id)arg1;
- (void)commonInit;
@
endint sharetext = 0;
NSString *sharemsg = @"";
%hook ImageMessageNodeView
%new(v@:@)
- (void)sharetotimeline{
UIImage *uimage = [%c(CMessageWrap) getMsgImg: MSHookIvar<CMessageWrap *>(self,"m_oMessageWrap")];
MMImage *mmimage = [[%c(MMImage) alloc] initWithImage:uimage];
[mmimage commonInit];
NSMutableArray* array = [[NSMutableArray alloc] initWithObjects:mmimage, nil];
WCNewCommitViewController *wcvc = [[%c(WCNewCommitViewController) alloc] initWithImages:array contacts:nil];
UINavigationController *navC = [[UINavigationController alloc] initWithRootViewController:wcvc];
id <messageNodeViewDelegate> delegate = MSHookIvar<id>(self,"m_delegate");
MMUIViewController *vc= [delegate getViewController];
[vc presentViewController:navC animated:YES completion:nil];
[wcvc release];
[navC release];
}
%end
%hook TextMessageNodeView
%new(v@:@)
- (void)sharetotimeline{
%log;
CMessageWrap *msgwrap = MSHookIvar<CMessageWrap *>(self,"m_oMessageWrap");
NSString *msgtext =[msgwrap m_nsContent];
sharemsg = msgtext;
sharetext = 1;
WCNewCommitViewController *wcvc = [[%c(WCNewCommitViewController) alloc] initWithImages:nil contacts:nil];
UINavigationController *navC = [[UINavigationController alloc] initWithRootViewController:wcvc];
[wcvc setBCommmitOnlyText:1];
id <messageNodeViewDelegate> delegate = MSHookIvar<id>(self,"m_delegate");
MMUIViewController *vc= [delegate getViewController];
[vc presentViewController:navC animated:YES completion:nil];
[wcvc release];
[navC release];
}
%end
%hook WCNewCommitViewController
- (void)viewDidAppear:(_Bool)arg1{
if(sharetext){
MMGrowTextView *grow = MSHookIvar<MMGrowTextView *>(self,"_textView");
MMTextView *mmtext = MSHookIvar<MMTextView *>(grow,"_textView");
[mmtext setText:sharemsg];
[grow postTextChangeNotification];
sharemsg = @"";
sharetext = 0;
}
}
%end
%hook BaseMessageNodeView
- (void)showOperationMenu:(id)arg1 NeedDelete:(_Bool)arg2 {
NSLog(@"=======%s",object_getClassName(self));
CMessageWrap *mw = [self m_msgWrap];
if([mw IsTextMsg] || [mw IsImgMsg]]){
NSMutableArray *menuarray = [[NSMutableArray alloc]initWithArray:arg1];
UIMenuItem *menu_timeline = [[UIMenuItem alloc] initWithTitle:@"朋友圈" action:@selector(sharetotimeline)];
[menuarray insertObject:menu_timeline atIndex:0];
[menu_timeline release];
%orig(menuarray,arg2);
}else{
%orig;
}
}
%end
github 上不去。只好贴这里了。(方便自己发而已)