#import “huigwcvidiodownloader.h”
static MMTableViewCell *huigCell;
static MMTableView *huigView;
static WCTimeLineViewController *huigController;
%hook WCContentItemViewTemplateNewSight
%new
-
(WCMediaItem *)huigMediaItemFromSight
{
id responder = self;
while (![responder isKindOfClass:NSClassFromString(@“WCTimeLineViewController”)])
{
if ([responder isKindOfClass:NSClassFromString(@“MMTableViewCell”)])
{
huigCell = responder;
}
else if ([responder isKindOfClass:NSClassFromString(@“MMTableView”)])
{
huigView = responder;
responder = [responder nextResponder];
}
}huigController = responder;
if (!huigCell || !huigView || !huigController)
{
NSLog(@“huig: Failed to get video object.”);
return nil;
}NSIndexPath *indexPath = [huigView indexPathForCell:huigCell];
int itemIndex = [huigController calcDataItemIndex:[indexPath section]];
WCFacade *facade = [(MMServiceCenter *) [%c(MMServiceCenter) defaultCenter] getService:[%c(WCFacade) class]];
WCDataItem *dataItem = [facade getTimelineDataItemOfIndex:itemIndex];
WCContentItem *contentItem = dataItem.contentObj;
WCMediaItem *mediaItem = [contentItem.mediaList count] != 0 ? (contentItem.mediaList)[0] : nil;
return mediaItem;
}
%new
- (void)huigOnSaveToDisk
{
NSString *localPath = [[self huigMediaItemFromSight] pathForSightData];
UISaveVideoAtPathToSavedPhotosAlbum(localPath, nil, nil, nil);
}
%new
- (void)huigOnCopyURL
{
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = [self huigMediaItemFromSight].dataUrl.url;
}
static int huigCounter;
- (void)oLongTouch
{
huigCounter++;
if (huigCounter % 2 == 0) return;
[self becomeFirstResponder];
UIMenuItem *saveToDiskMenuItem = [[UIMenuItem alloc] initWithTitle:@“Save to Disk” action:@selector(huigOnSaveToDisk)];
UIMenuItem *copyURLMenuItem = [[UIMenuItem alloc] initWithTitle:@“Copy URL” action:@selector(huigOnCopyURL)];
UIMenuController *menuController = [UIMenuController sharedMenuController];
[menuController setMenuItems:@[saveToDiskMenuItem, copyURLMenuItem]];
[menuController setTargetRect:CGRectZero inView:self];
[menuController setMenuVisible:YES animated:YES];
[saveToDiskMenuItem release];
[copyURLMenuItem release];
}
%end
用 App admin 插件官网下载的微信6.0 tweak 代码如上,安装后长按视频没有出现 添加的 Save to Disk 和 Copy URL .不知怎么回事.求解.谢谢