撸了一个转发朋友圈的东西。。。有感兴趣的朋友吗??

2016-11-13 20:48:44 +08:00
 yivanus

有时候吧。需要转发一点收到的信息到朋友圈去。特别是别人发来的图片先下载到本地再去通过朋友圈发出来。 感觉好麻烦。 文字也是一样的需要先复制再去打开朋友圈来粘贴。麻烦死了。

目前实现的功能,在聊天界面选中要转发的文字或者图片(目前只能一个),然后长按会出现 菜单,选中朋友圈就可以转发到朋友圈,在编辑界面也可以正常的编辑文字或者给图片加上文字描述什么的。

有人感兴趣的话我就发一下代码。

6011 次点击
所在节点    微信
29 条回复
yivanus
2017-01-11 18:16:07 +08:00
@interface MMUIViewController : UIViewController
{
UINavigationController *m_navigationController;
}
@end
@interface CMessageWrap:NSObject
{}
@property(retain, nonatomic) NSString *m_nsContent;
+ (id)getMsgImg:(id)arg1;
+ (id)getMaskedVideoMsgImgThumb:(id)arg1;
@end
@protocol messageNodeViewDelegate <NSObject>
- (MMUIViewController *)getViewController;
@end
@interface BaseMessageNodeView : NSObject
{
CMessageWrap *m_oMessageWrap;
id <messageNodeViewDelegate> m_delegate;
}
@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;
- (void)OnDone;
@end

@interface SightMomentEditViewController : MMUIViewController
{
NSString *_realMoviePath;
NSString *_moviePath;
UIImage *_thumbImage;
UIImage *_realThumbImage;
}
@property(nonatomic) _Bool directClose;
@property(nonatomic) _Bool fromDraft;
@property(retain, nonatomic) NSString *moviePath;
@property(retain, nonatomic) NSString *realMoviePath;
@property(retain, nonatomic) UIImage *realThumbImage;
@property(retain, nonatomic) UIImage *thumbImage;
- (id)init;
@end

@interface ImageMessageNodeView : BaseMessageNodeView
{}
- (void)onForward:(id)arg1;
@end

@interface MMImage : NSObject
{}
- (id)initWithImage:(id)arg1;
- (void)commonInit;
@end


@interface TextMessageNodeView : BaseMessageNodeView
{}
- (void)onForward:(id)arg1;
@end

@interface VideoMessageNodeView : BaseMessageNodeView
{
NSString *m_videoPath;
}
- (id)getCoverImage;
- (id)getMessageImageView;
- (id)thumbImage;
- (void)onForward:(id)arg1;
@end


int sharetext = 0;
NSString *sharemsg = @"";

%hook ImageMessageNodeView
- (void)onForward:(id)arg1{
id <messageNodeViewDelegate> delegate = MSHookIvar<id>(self,"m_delegate");
MMUIViewController *vc= [delegate getViewController];
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];
[vc presentViewController:navC animated:YES completion:nil];
[wcvc release];
[navC release];
}
%end



%hook TextMessageNodeView
- (void)onForward:(id)arg1{
%log;
id <messageNodeViewDelegate> delegate = MSHookIvar<id>(self,"m_delegate");
MMUIViewController *vc= [delegate getViewController];
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];
[vc presentViewController:navC animated:YES completion:nil];
[wcvc release];
[navC release];
}
%end

%hook VideoMessageNodeView
- (void)onForward:(id)arg1{
%log;
SightMomentEditViewController *wcvc = [[%c(SightMomentEditViewController) alloc] init];
NSLog(@"============all oc init here");
NSString *vpath=MSHookIvar<NSString *>(self,"m_videoPath");
NSLog(@"====video path%@",vpath);
[wcvc setMoviePath:vpath];
[wcvc setRealMoviePath:vpath];
[wcvc setThumbImage:[%c(CMessageWrap) getMaskedVideoMsgImgThumb: MSHookIvar<CMessageWrap *>(self,"m_oMessageWrap")]];
[wcvc setRealThumbImage: [%c(CMessageWrap) getMaskedVideoMsgImgThumb: MSHookIvar<CMessageWrap *>(self,"m_oMessageWrap")]];
[wcvc setFromDraft:1];
[wcvc setDirectClose:1];
UINavigationController *navC = [[UINavigationController alloc] initWithRootViewController:wcvc];
id <messageNodeViewDelegate> delegate = MSHookIvar<id>(self,"m_delegate");
MMUIViewController *vc= [delegate getViewController];
NSLog(@"===%@",vc);
[vc presentViewController:navC animated:YES completion:nil];
[wcvc release];
[navC release];
}
%end


%hook WCNewCommitViewController
- (id)initWithImages:(id)arg1 contacts:(id)arg2{
NSLog(@"==%@",arg1);
%log;
return %orig;
}

- (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

这个是以前的代码。。。。后面自己也不想玩了。可能还有 bug 吧。想玩的就调试下吧。
kensla
2017-01-11 19:32:41 +08:00
@yivanus 这代码编译不了的
kensla
2017-01-11 19:56:13 +08:00
https://git.oschina.net/604217454/timelinetweak.git 这个是代码,方便测试下么
yivanus
2017-01-11 23:37:01 +08:00
2017-01-11 23:35:57.780 xcodebuild[8802:302869] [MT] DVTPlugInManager: Required plug-in compatibility UUID E0A62D1F-3C18-4D74-BFE5-A4167D643966 for HHEnumeration-Xcode.ideplugin (com.huaxi.HHEnumeration) not present
> Making all for tweak timeline …
==> Preprocessing Tweak.xm …
==> Compiling Tweak.xm (armv7)…
==> Linking tweak timeline (armv7)…
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of iOS 7
==> Preprocessing Tweak.xm …
==> Compiling Tweak.xm (arm64)…
==> Linking tweak timeline (arm64)…
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of iOS 7
==> Merging tweak timeline …
2017-01-11 23:36:22.202 xcodebuild[9043:303448] [MT] DVTPlugInManager: Required plug-in compatibility UUID E0A62D1F-3C18-4D74-BFE5-A4167D643966 for HHEnumeration-Xcode.ideplugin (com.huaxi.HHEnumeration) not present
==> Signing timeline …
> Making stage for tweak timeline …
dpkg-deb: warning: deprecated compression type 'lzma'; use xz instead
dpkg-deb: warning: ignoring 1 warning about the control file(s)
dpkg-deb: building package 'com.xfunforx.timeline' in './packages/com.xfunforx.timeline_0.0.1-66+debug_iphoneos-arm.deb'.
yivanus
2017-01-11 23:40:17 +08:00
@kensla 用你的那段代码编译的
kensla
2017-01-12 08:19:41 +08:00
@yivanus 那个码云的代码可以编译,在 6.5.3 版本没有效果,是不是不能用了?
yivanus
2017-01-12 21:01:23 +08:00
@kensla 你一会说不能编译,一会说能编译,到底能不能编译??
kensla
2017-01-13 17:58:55 +08:00
@yivanus 你最开始发的代码不能编译,后面发的我放到开源中国的码云上了,码云那个可以编译。但是装到越狱手机上没有效果
yivanus
2017-01-14 14:15:01 +08:00
微信的新版本更新后,有类找不到了。

Jan 14 14:14:09 maruko WeChat[1501] <Error>: [timeline] Tweak.xm:241 ERROR: logos: nil class ImageMessageNodeView
Jan 14 14:14:09 maruko WeChat[1501] <Error>: [timeline] Tweak.xm:241 ERROR: logos: nil class TextMessageNodeView
Jan 14 14:14:09 maruko WeChat[1501] <Error>: [timeline] Tweak.xm:241 ERROR: logos: nil class VideoMessageNodeView
Jan 14 14:14:09 maruko WeChat[1501] <Error>: [timeline] Tweak.xm:241 ERROR: logos: nil class BaseMessageNodeView

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/320226

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX