diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0a1aba2a..a2224398 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,13 @@
# 更新日志
+### [v1.4.0 (2017-10-11)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.4.0)
+
+* 新增微信窗口置顶
+* 新增最近联系人多选删除
+* 新增远程控制信息回调
+* 新增手机端获取指令信息
+
### [v1.3.0 (2017-09-17)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.3.0)
* 新增最近联系人置底功能
diff --git a/Other/Install.sh b/Other/Install.sh
index 2e9d4614..e6c4c00a 100755
--- a/Other/Install.sh
+++ b/Other/Install.sh
@@ -22,7 +22,7 @@ then
cp "$app_executable_path" "$app_executable_backup_path"
result="y"
else
-read -t 15 -p "已安装微信小助手,是否覆盖?[y/n]:" result
+read -t 150 -p "已安装微信小助手,是否覆盖?[y/n]:" result
fi
if [[ "$result" == 'y' ]]; then
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Headers/WeChatPlugin.h b/Other/Products/Debug/WeChatPlugin.framework/Headers/WeChatPlugin.h
index 7c8e857e..42b0395a 100644
--- a/Other/Products/Debug/WeChatPlugin.framework/Headers/WeChatPlugin.h
+++ b/Other/Products/Debug/WeChatPlugin.framework/Headers/WeChatPlugin.h
@@ -125,6 +125,8 @@ FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[];
@property(retain, nonatomic) MMSessionInfo *sessionInfo;
- (void)menuWillOpen:(id)arg1;
- (void)contextMenuSticky;
+- (void)contextMenuDelete;
+
@end
@interface MMSessionMgr : NSObject
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Resources/TKRemoteControlCommands.plist b/Other/Products/Debug/WeChatPlugin.framework/Resources/TKRemoteControlCommands.plist
index b0bafc36..4a039a4c 100644
--- a/Other/Products/Debug/WeChatPlugin.framework/Resources/TKRemoteControlCommands.plist
+++ b/Other/Products/Debug/WeChatPlugin.framework/Resources/TKRemoteControlCommands.plist
@@ -7,7 +7,7 @@
executeCommand
open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app || open /System/Library/CoreServices/ScreenSaverEngine.app
keyword
- TK-PMBH
+ ScreenSave
function
屏幕保护
enable
@@ -17,7 +17,7 @@
executeCommand
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
keyword
- TK-SP
+ LockScreen
function
锁屏
enable
@@ -27,7 +27,7 @@
executeCommand
sleep
keyword
- TK-XM
+ Sleep
function
休眠
enable
@@ -37,7 +37,7 @@
executeCommand
shutdown
keyword
- TK-GJ
+ Shutdown
function
关机
enable
@@ -47,7 +47,7 @@
executeCommand
restart
keyword
- TK-CQ
+ Restart
function
重启
enable
@@ -57,7 +57,7 @@
executeCommand
empty
keyword
- TK-QK
+ EmptyTrash
function
清空废纸篓
enable
@@ -69,7 +69,7 @@
executeCommand
killQQ
keyword
- TK-QQ
+ KillQQ
function
退出 QQ
enable
@@ -79,7 +79,7 @@
executeCommand
killWeChat
keyword
- TK-WeChat
+ KillWeChat
function
退出 WeChat
enable
@@ -89,7 +89,7 @@
executeCommand
killChrome
keyword
- TK-Chrome
+ KillChrome
function
退出 Chrome
enable
@@ -99,7 +99,7 @@
executeCommand
killSafari
keyword
- TK-Safari
+ KillSafari
function
退出 Safari
enable
@@ -109,7 +109,7 @@
executeCommand
killAll
keyword
- TK-All
+ KillAll
function
退出所有程序
enable
@@ -121,61 +121,61 @@
executeCommand
musicToggle
keyword
- TK-Toggle
+ Toggle
function
播放/暂停
enable
-
+
executeCommand
musicNext
keyword
- TK-Next
+ Next
function
下一首
enable
-
+
executeCommand
musicPrevious
keyword
- TK-Previous
+ Previous
function
上一首
enable
-
+
executeCommand
musicVolumeUp
keyword
- TK-VolumeUp
+ VolumeUp
function
增大音量
enable
-
+
executeCommand
musicVolumeDown
keyword
- TK-VolumeDown
+ VolumeDown
function
减小音量
enable
-
+
executeCommand
musicLike
keyword
- TK-Like
+ LikeChange
function
喜欢/取消喜欢
enable
-
+
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Resources/TKRemoteControlWindowController.nib b/Other/Products/Debug/WeChatPlugin.framework/Resources/TKRemoteControlWindowController.nib
index db7fa5d9..d74c58a6 100644
Binary files a/Other/Products/Debug/WeChatPlugin.framework/Resources/TKRemoteControlWindowController.nib and b/Other/Products/Debug/WeChatPlugin.framework/Resources/TKRemoteControlWindowController.nib differ
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Headers/WeChatPlugin.h b/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Headers/WeChatPlugin.h
index 7c8e857e..42b0395a 100644
--- a/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Headers/WeChatPlugin.h
+++ b/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Headers/WeChatPlugin.h
@@ -125,6 +125,8 @@ FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[];
@property(retain, nonatomic) MMSessionInfo *sessionInfo;
- (void)menuWillOpen:(id)arg1;
- (void)contextMenuSticky;
+- (void)contextMenuDelete;
+
@end
@interface MMSessionMgr : NSObject
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Resources/TKRemoteControlCommands.plist b/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Resources/TKRemoteControlCommands.plist
index b0bafc36..4a039a4c 100644
--- a/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Resources/TKRemoteControlCommands.plist
+++ b/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Resources/TKRemoteControlCommands.plist
@@ -7,7 +7,7 @@
executeCommand
open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app || open /System/Library/CoreServices/ScreenSaverEngine.app
keyword
- TK-PMBH
+ ScreenSave
function
屏幕保护
enable
@@ -17,7 +17,7 @@
executeCommand
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
keyword
- TK-SP
+ LockScreen
function
锁屏
enable
@@ -27,7 +27,7 @@
executeCommand
sleep
keyword
- TK-XM
+ Sleep
function
休眠
enable
@@ -37,7 +37,7 @@
executeCommand
shutdown
keyword
- TK-GJ
+ Shutdown
function
关机
enable
@@ -47,7 +47,7 @@
executeCommand
restart
keyword
- TK-CQ
+ Restart
function
重启
enable
@@ -57,7 +57,7 @@
executeCommand
empty
keyword
- TK-QK
+ EmptyTrash
function
清空废纸篓
enable
@@ -69,7 +69,7 @@
executeCommand
killQQ
keyword
- TK-QQ
+ KillQQ
function
退出 QQ
enable
@@ -79,7 +79,7 @@
executeCommand
killWeChat
keyword
- TK-WeChat
+ KillWeChat
function
退出 WeChat
enable
@@ -89,7 +89,7 @@
executeCommand
killChrome
keyword
- TK-Chrome
+ KillChrome
function
退出 Chrome
enable
@@ -99,7 +99,7 @@
executeCommand
killSafari
keyword
- TK-Safari
+ KillSafari
function
退出 Safari
enable
@@ -109,7 +109,7 @@
executeCommand
killAll
keyword
- TK-All
+ KillAll
function
退出所有程序
enable
@@ -121,61 +121,61 @@
executeCommand
musicToggle
keyword
- TK-Toggle
+ Toggle
function
播放/暂停
enable
-
+
executeCommand
musicNext
keyword
- TK-Next
+ Next
function
下一首
enable
-
+
executeCommand
musicPrevious
keyword
- TK-Previous
+ Previous
function
上一首
enable
-
+
executeCommand
musicVolumeUp
keyword
- TK-VolumeUp
+ VolumeUp
function
增大音量
enable
-
+
executeCommand
musicVolumeDown
keyword
- TK-VolumeDown
+ VolumeDown
function
减小音量
enable
-
+
executeCommand
musicLike
keyword
- TK-Like
+ LikeChange
function
喜欢/取消喜欢
enable
-
+
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Resources/TKRemoteControlWindowController.nib b/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Resources/TKRemoteControlWindowController.nib
index db7fa5d9..d74c58a6 100644
Binary files a/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Resources/TKRemoteControlWindowController.nib and b/Other/Products/Debug/WeChatPlugin.framework/Versions/A/Resources/TKRemoteControlWindowController.nib differ
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Versions/A/WeChatPlugin b/Other/Products/Debug/WeChatPlugin.framework/Versions/A/WeChatPlugin
index a8d92159..92427280 100755
Binary files a/Other/Products/Debug/WeChatPlugin.framework/Versions/A/WeChatPlugin and b/Other/Products/Debug/WeChatPlugin.framework/Versions/A/WeChatPlugin differ
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Headers/WeChatPlugin.h b/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Headers/WeChatPlugin.h
index 7c8e857e..42b0395a 100644
--- a/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Headers/WeChatPlugin.h
+++ b/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Headers/WeChatPlugin.h
@@ -125,6 +125,8 @@ FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[];
@property(retain, nonatomic) MMSessionInfo *sessionInfo;
- (void)menuWillOpen:(id)arg1;
- (void)contextMenuSticky;
+- (void)contextMenuDelete;
+
@end
@interface MMSessionMgr : NSObject
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Resources/TKRemoteControlCommands.plist b/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Resources/TKRemoteControlCommands.plist
index b0bafc36..4a039a4c 100644
--- a/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Resources/TKRemoteControlCommands.plist
+++ b/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Resources/TKRemoteControlCommands.plist
@@ -7,7 +7,7 @@
executeCommand
open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app || open /System/Library/CoreServices/ScreenSaverEngine.app
keyword
- TK-PMBH
+ ScreenSave
function
屏幕保护
enable
@@ -17,7 +17,7 @@
executeCommand
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
keyword
- TK-SP
+ LockScreen
function
锁屏
enable
@@ -27,7 +27,7 @@
executeCommand
sleep
keyword
- TK-XM
+ Sleep
function
休眠
enable
@@ -37,7 +37,7 @@
executeCommand
shutdown
keyword
- TK-GJ
+ Shutdown
function
关机
enable
@@ -47,7 +47,7 @@
executeCommand
restart
keyword
- TK-CQ
+ Restart
function
重启
enable
@@ -57,7 +57,7 @@
executeCommand
empty
keyword
- TK-QK
+ EmptyTrash
function
清空废纸篓
enable
@@ -69,7 +69,7 @@
executeCommand
killQQ
keyword
- TK-QQ
+ KillQQ
function
退出 QQ
enable
@@ -79,7 +79,7 @@
executeCommand
killWeChat
keyword
- TK-WeChat
+ KillWeChat
function
退出 WeChat
enable
@@ -89,7 +89,7 @@
executeCommand
killChrome
keyword
- TK-Chrome
+ KillChrome
function
退出 Chrome
enable
@@ -99,7 +99,7 @@
executeCommand
killSafari
keyword
- TK-Safari
+ KillSafari
function
退出 Safari
enable
@@ -109,7 +109,7 @@
executeCommand
killAll
keyword
- TK-All
+ KillAll
function
退出所有程序
enable
@@ -121,61 +121,61 @@
executeCommand
musicToggle
keyword
- TK-Toggle
+ Toggle
function
播放/暂停
enable
-
+
executeCommand
musicNext
keyword
- TK-Next
+ Next
function
下一首
enable
-
+
executeCommand
musicPrevious
keyword
- TK-Previous
+ Previous
function
上一首
enable
-
+
executeCommand
musicVolumeUp
keyword
- TK-VolumeUp
+ VolumeUp
function
增大音量
enable
-
+
executeCommand
musicVolumeDown
keyword
- TK-VolumeDown
+ VolumeDown
function
减小音量
enable
-
+
executeCommand
musicLike
keyword
- TK-Like
+ LikeChange
function
喜欢/取消喜欢
enable
-
+
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Resources/TKRemoteControlWindowController.nib b/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Resources/TKRemoteControlWindowController.nib
index db7fa5d9..d74c58a6 100644
Binary files a/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Resources/TKRemoteControlWindowController.nib and b/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/Resources/TKRemoteControlWindowController.nib differ
diff --git a/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/WeChatPlugin b/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/WeChatPlugin
index a8d92159..92427280 100755
Binary files a/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/WeChatPlugin and b/Other/Products/Debug/WeChatPlugin.framework/Versions/Current/WeChatPlugin differ
diff --git a/Other/Products/Debug/WeChatPlugin.framework/WeChatPlugin b/Other/Products/Debug/WeChatPlugin.framework/WeChatPlugin
index a8d92159..92427280 100755
Binary files a/Other/Products/Debug/WeChatPlugin.framework/WeChatPlugin and b/Other/Products/Debug/WeChatPlugin.framework/WeChatPlugin differ
diff --git a/README.md b/README.md
index ee5cfef6..492e7a17 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
![](https://img.shields.io/badge/platform-osx-lightgrey.svg) ![](https://img.shields.io/badge/support-wechat%202.2.8-green.svg)
-微信小助手 v1.3.0
+微信小助手 v1.4.0
![微信小助手.png](http://upload-images.jianshu.io/upload_images/965383-31708af611b55ca4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
@@ -15,6 +15,8 @@
### 更新日志
+[新增窗口置顶&多选删除等等 (2017-10-11)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.4.0)
+
[新增置底&免认证 (2017-09-17)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.3.0)
[修复聊天记录消失的bug (2017-09-11)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.2.0)
@@ -37,6 +39,8 @@
远程控制:
+>远程控制新增指令发送成功回调、发送`获取指令`获得当前所有远程控制信息。
+
- [x] 屏幕保护
- [x] 清空废纸篓
- [x] 锁屏、休眠、关机、重启
@@ -79,7 +83,7 @@
**1. 普通安装**
-* 点击`clone or download`按钮下载 WeChatPlugin 并解压,用 Termimal 打开项目当前目录,执行 `./Other/Install.sh`即可。
+* 点击`clone or download`按钮下载 WeChatPlugin 至`下载`目录并解压,打开Termimal,执行 `~/Downloads/WeChatPlugin-MacOS-master/Other/Install.sh`即可。
**2. 若想修改源码&重编译**
@@ -124,6 +128,11 @@
②为能够触发远程控制的消息内容(仅向自己发送账号有效)。
+
+* 远程控制:发送`获取指令`,手机端可查看所有指令信息。
+
+![远程控制.png](http://upload-images.jianshu.io/upload_images/965383-7c2a4b17e5a6867f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
+
---
### 卸载
diff --git a/WeChatPlugin.xcodeproj/project.xcworkspace/xcuserdata/TK.xcuserdatad/UserInterfaceState.xcuserstate b/WeChatPlugin.xcodeproj/project.xcworkspace/xcuserdata/TK.xcuserdatad/UserInterfaceState.xcuserstate
index 611de6f9..cad55ce8 100644
Binary files a/WeChatPlugin.xcodeproj/project.xcworkspace/xcuserdata/TK.xcuserdatad/UserInterfaceState.xcuserstate and b/WeChatPlugin.xcodeproj/project.xcworkspace/xcuserdata/TK.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/WeChatPlugin.xcodeproj/xcuserdata/TK.xcuserdatad/xcschemes/WeChatPlugin.xcscheme b/WeChatPlugin.xcodeproj/xcuserdata/TK.xcuserdatad/xcschemes/WeChatPlugin.xcscheme
index 13aa3386..bc4c3034 100644
--- a/WeChatPlugin.xcodeproj/xcuserdata/TK.xcuserdatad/xcschemes/WeChatPlugin.xcscheme
+++ b/WeChatPlugin.xcodeproj/xcuserdata/TK.xcuserdatad/xcschemes/WeChatPlugin.xcscheme
@@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
@@ -36,6 +37,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
diff --git a/WeChatPlugin/Sources/Category/WeChat+hook.m b/WeChatPlugin/Sources/Category/WeChat+hook.m
index d2bd4264..6d5b6be8 100644
--- a/WeChatPlugin/Sources/Category/WeChat+hook.m
+++ b/WeChatPlugin/Sources/Category/WeChat+hook.m
@@ -65,7 +65,7 @@ + (void)addAssistantMenuItem {
// 免认证登录
NSMenuItem *autoAuthItem = [[NSMenuItem alloc] initWithTitle:@"免认证登录" action:@selector(onAutoAuthControl:) keyEquivalent:@"M"];
autoAuthItem.state = [[TKWeChatPluginConfig sharedConfig] autoAuthEnable];
-
+
NSMenu *subMenu = [[NSMenu alloc] initWithTitle:@"微信小助手"];
[subMenu addItem:preventRevokeItem];
[subMenu addItem:autoReplyItem];
@@ -73,18 +73,18 @@ + (void)addAssistantMenuItem {
[subMenu addItem:newWeChatItem];
[subMenu addItem:onTopItem];
[subMenu addItem:autoAuthItem];
-
+
NSMenuItem *menuItem = [[NSMenuItem alloc] init];
[menuItem setTitle:@"微信小助手"];
[menuItem setSubmenu:subMenu];
-
+
[[[NSApplication sharedApplication] mainMenu] addItem:menuItem];
}
#pragma mark - menuItem 的点击事件
/**
菜单栏-微信小助手-消息防撤回 设置
-
+
@param item 消息防撤回的item
*/
- (void)onPreventRevoke:(NSMenuItem *)item {
@@ -94,18 +94,18 @@ - (void)onPreventRevoke:(NSMenuItem *)item {
/**
菜单栏-微信小助手-自动回复 设置
-
+
@param item 自动回复设置的item
*/
- (void)onAutoReply:(NSMenuItem *)item {
WeChat *wechat = [objc_getClass("WeChat") sharedInstance];
TKAutoReplyWindowController *autoReplyWC = objc_getAssociatedObject(wechat, &tkAutoReplyWindowControllerKey);
-
+
if (!autoReplyWC) {
autoReplyWC = [[TKAutoReplyWindowController alloc] initWithWindowNibName:@"TKAutoReplyWindowController"];
objc_setAssociatedObject(wechat, &tkAutoReplyWindowControllerKey, autoReplyWC, OBJC_ASSOCIATION_RETAIN);
}
-
+
[autoReplyWC showWindow:autoReplyWC];
[autoReplyWC.window center];
[autoReplyWC.window makeKeyWindow];
@@ -113,7 +113,7 @@ - (void)onAutoReply:(NSMenuItem *)item {
/**
打开新的微信
-
+
@param item 登录新微信的item
*/
- (void)onNewWechatInstance:(NSMenuItem *)item {
@@ -122,18 +122,18 @@ - (void)onNewWechatInstance:(NSMenuItem *)item {
/**
菜单栏-帮助-远程控制 MAC OS 设置
-
+
@param item 远程控制的item
*/
- (void)onRemoteControl:(NSMenuItem *)item {
WeChat *wechat = [objc_getClass("WeChat") sharedInstance];
TKRemoteControlWindowController *remoteControlWC = objc_getAssociatedObject(wechat, &tkRemoteControlWindowControllerKey);
-
+
if (!remoteControlWC) {
remoteControlWC = [[TKRemoteControlWindowController alloc] initWithWindowNibName:@"TKRemoteControlWindowController"];
objc_setAssociatedObject(wechat, &tkRemoteControlWindowControllerKey, remoteControlWC, OBJC_ASSOCIATION_RETAIN);
}
-
+
[remoteControlWC showWindow:remoteControlWC];
[remoteControlWC.window center];
[remoteControlWC.window makeKeyWindow];
@@ -141,7 +141,7 @@ - (void)onRemoteControl:(NSMenuItem *)item {
/**
菜单栏-微信小助手-免认证登录 设置
-
+
@param item 免认证登录的 item
*/
- (void)onAutoAuthControl:(NSMenuItem *)item {
@@ -164,7 +164,7 @@ - (void)onWechatOnTopControl:(NSMenuItem *)item {
#pragma mark - hook 微信方法
/**
hook 微信是否已启动
-
+
*/
+ (BOOL)hook_HasWechatInstance {
return NO;
@@ -172,7 +172,7 @@ + (BOOL)hook_HasWechatInstance {
/**
hook 微信撤回消息
-
+
*/
- (void)hook_onRevokeMsg:(id)msg {
if (![[TKWeChatPluginConfig sharedConfig] preventRevokeEnable]) {
@@ -235,24 +235,25 @@ - (void)hook_onRevokeMsg:(id)msg {
/**
hook 微信消息同步
-
+
*/
- (void)hook_OnSyncBatchAddMsgs:(NSArray *)msgs isFirstSync:(BOOL)arg2 {
[self hook_OnSyncBatchAddMsgs:msgs isFirstSync:arg2];
-
+
[msgs enumerateObjectsUsingBlock:^(AddMsg *addMsg, NSUInteger idx, BOOL * _Nonnull stop) {
NSDate *now = [NSDate date];
NSTimeInterval nowSecond = now.timeIntervalSince1970;
if (nowSecond - addMsg.createTime > 180) { // 若是3分钟前的消息,则不进行自动回复与远程控制。
return;
}
-
+
[self autoReplyWithMsg:addMsg];
-
+
NSString *currentUserName = [objc_getClass("CUtility") GetCurrentUserName];
if ([addMsg.fromUserName.string isEqualToString:currentUserName] &&
[addMsg.toUserName.string isEqualToString:currentUserName]) {
[self remoteControlWithMsg:addMsg];
+ [self replySelfWithMsg:addMsg];
}
}];
}
@@ -262,7 +263,7 @@ - (void)hook_onLoginButtonClicked:(NSButton *)btn {
BOOL autoAuthEnable = [[TKWeChatPluginConfig sharedConfig] autoAuthEnable];
if (autoAuthEnable && [accountService canAutoAuth]) {
[accountService AutoAuth];
-
+
WeChat *wechat = [objc_getClass("WeChat") sharedInstance];
MMLoginOneClickViewController *loginVC = wechat.mainWindowController.loginViewController.oneClickViewController;
loginVC.loginButton.hidden = YES;
@@ -290,7 +291,7 @@ - (void)hook_sortSessions {
NSMutableArray *arrSession = sessionMgr.m_arrSession;
NSMutableArray *ignoreSessions = [[[TKWeChatPluginConfig sharedConfig] ignoreSessionModels] mutableCopy];
- NSString *currentUserName = [objc_getClass("CUtility") GetCurrentUserName];
+ NSString *currentUserName = [objc_getClass("CUtility") GetCurrentUserName];
[ignoreSessions enumerateObjectsUsingBlock:^(TKIgnoreSessonModel *model, NSUInteger index, BOOL * _Nonnull stop) {
__block NSInteger ignoreIdx = -1;
[arrSession enumerateObjectsUsingBlock:^(MMSessionInfo *sessionInfo, NSUInteger idx, BOOL * _Nonnull stop) {
@@ -314,12 +315,12 @@ - (void)hook_sortSessions {
#pragma mark - Other
/**
自动回复
-
+
@param addMsg 接收的消息
*/
- (void)autoReplyWithMsg:(AddMsg *)addMsg {
if (addMsg.msgType != 1 && addMsg.msgType != 3) return;
-
+
ContactStorage *contactStorage = [[objc_getClass("MMServiceCenter") defaultCenter] getService:objc_getClass("ContactStorage")];
WCContactData *msgContact = [contactStorage GetContact:addMsg.fromUserName.string];
if (msgContact.m_uiFriendScene == 0 && ![addMsg.fromUserName.string containsString:@"@chatroom"]) {
@@ -336,7 +337,7 @@ - (void)autoReplyWithMsg:(AddMsg *)addMsg {
if (!model.replyContent || model.replyContent.length == 0) return;
if ([addMsg.fromUserName.string containsString:@"@chatroom"] && !model.enableGroupReply) return;
if (![addMsg.fromUserName.string containsString:@"@chatroom"] && !model.enableSingleReply) return;
-
+
NSString *msgContent = addMsg.content.string;
if ([addMsg.fromUserName.string containsString:@"@chatroom"]) {
NSRange range = [msgContent rangeOfString:@":\n"];
@@ -344,11 +345,11 @@ - (void)autoReplyWithMsg:(AddMsg *)addMsg {
msgContent = [msgContent substringFromIndex:range.location + range.length];
}
}
-
+
NSArray *replyArray = [model.replyContent componentsSeparatedByString:@"|"];
int index = arc4random() % replyArray.count;
NSString *randomReplyContent = replyArray[index];
-
+
if (model.enableRegex) {
NSString *regex = model.keyword;
NSError *error;
@@ -371,7 +372,7 @@ - (void)autoReplyWithMsg:(AddMsg *)addMsg {
/**
远程控制
-
+
@param addMsg 接收的消息
*/
- (void)remoteControlWithMsg:(AddMsg *)addMsg {
@@ -380,6 +381,17 @@ - (void)remoteControlWithMsg:(AddMsg *)addMsg {
}
}
+- (void)replySelfWithMsg:(AddMsg *)addMsg {
+ if (addMsg.msgType != 1 && addMsg.msgType != 3) return;
+
+ if ([addMsg.content.string isEqualToString:@"获取指令"]) {
+ NSString *currentUserName = [objc_getClass("CUtility") GetCurrentUserName];
+ NSString *callBack = [TKRemoteControlController remoteControlCommandsString];
+ MessageService *service = [[objc_getClass("MMServiceCenter") defaultCenter] getService:objc_getClass("MessageService")];
+ [service SendTextMessage:currentUserName toUsrName:currentUserName msgText:callBack atUserList:nil];
+ }
+}
+
#pragma mark -- 替换部分调用了 NSSearchPathForDirectoriesInDomains 的方法
+ (void)replaceAboutFilePathMethod {
tk_hookMethod(objc_getClass("JTStatisticManager"), @selector(statFilePath), [self class], @selector(hook_statFilePath));
@@ -405,7 +417,7 @@ + (unsigned long long)hook_getFreeDiskSpace {
if (documentPath.length == 0) {
return [self hook_getFreeDiskSpace];
}
-
+
NSString *newDocumentPath = [self realFilePathWithOriginFilePath:documentPath originKeyword:@"/Documents"];
if (newDocumentPath.length > 0) {
NSFileManager *fileManager = [NSFileManager defaultManager];
diff --git a/WeChatPlugin/Sources/Controllers/TKRemoteControlController.h b/WeChatPlugin/Sources/Controllers/TKRemoteControlController.h
index b1a21f1b..29ad7d03 100644
--- a/WeChatPlugin/Sources/Controllers/TKRemoteControlController.h
+++ b/WeChatPlugin/Sources/Controllers/TKRemoteControlController.h
@@ -12,5 +12,6 @@
+ (void)executeRemoteControlCommandWithMsg:(NSString *)msg;
+ (void)executeShellCommand:(NSString *)msg;
++ (NSString *)remoteControlCommandsString;
@end
diff --git a/WeChatPlugin/Sources/Controllers/TKRemoteControlController.m b/WeChatPlugin/Sources/Controllers/TKRemoteControlController.m
index 80f26fc6..2334092b 100644
--- a/WeChatPlugin/Sources/Controllers/TKRemoteControlController.m
+++ b/WeChatPlugin/Sources/Controllers/TKRemoteControlController.m
@@ -9,6 +9,7 @@
#import "TKRemoteControlController.h"
#import "TKWeChatPluginConfig.h"
#import "TKRemoteControlModel.h"
+#import "WeChatPlugin.h"
// 执行 AppleScript
static NSString * const kRemoteControlAppleScript = @"osascript /Applications/WeChat.app/Contents/MacOS/WeChatPlugin.framework/Resources/TKRemoteControlScript.scpt";
@@ -35,6 +36,10 @@ + (void)executeRemoteControlCommandWithMsg:(NSString *)msg {
}
});
}
+ NSString *currentUserName = [objc_getClass("CUtility") GetCurrentUserName];
+ NSString *callBack = [NSString stringWithFormat:@"小助手收到一条指令:%@",model.function];
+ MessageService *service = [[objc_getClass("MMServiceCenter") defaultCenter] getService:objc_getClass("MessageService")];
+ [service SendTextMessage:currentUserName toUsrName:currentUserName msgText:callBack atUserList:nil];
}
}];
}];
@@ -42,7 +47,7 @@ + (void)executeRemoteControlCommandWithMsg:(NSString *)msg {
/**
通过 NSTask 执行 Shell 命令
-
+
@param cmd Terminal命令
*/
+ (void)executeShellCommand:(NSString *)cmd {
@@ -52,4 +57,30 @@ + (void)executeShellCommand:(NSString *)cmd {
[task launch];
}
++ (NSString *)remoteControlCommandsString {
+ NSMutableString *replyContent = [NSMutableString stringWithFormat:@"远程控制指令:\n(功能-指令-是否开启)\n\n"];
+
+ NSArray *remoteControlModels = [TKWeChatPluginConfig sharedConfig].remoteControlModels;
+ [remoteControlModels enumerateObjectsUsingBlock:^(NSArray *subModels, NSUInteger index, BOOL * _Nonnull stop) {
+ switch (index) {
+ case 0:
+ [replyContent appendString:@"macbook控制:\n"];
+ break;
+ case 1:
+ [replyContent appendString:@"app控制:\n"];
+ break;
+ case 2:
+ [replyContent appendString:@"网易云音乐控制:\n"];
+ break;
+ default:
+ break;
+ }
+ [subModels enumerateObjectsUsingBlock:^(TKRemoteControlModel *model, NSUInteger idx, BOOL * _Nonnull stop) {
+ [replyContent appendFormat:@"%@-%@-%@\n", model.function, model.keyword, model.enable ? @"开启":@"关闭"];
+ }];
+ [replyContent appendString:@"\n"];
+ }];
+ return replyContent;
+}
+
@end
diff --git a/WeChatPlugin/Sources/WindowControllers/RemoteControl/TKRemoteControlWindowController.xib b/WeChatPlugin/Sources/WindowControllers/RemoteControl/TKRemoteControlWindowController.xib
index 50017c37..8ad75ba6 100644
--- a/WeChatPlugin/Sources/WindowControllers/RemoteControl/TKRemoteControlWindowController.xib
+++ b/WeChatPlugin/Sources/WindowControllers/RemoteControl/TKRemoteControlWindowController.xib
@@ -1,8 +1,8 @@
-
+
-
+
@@ -32,6 +32,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -45,7 +56,7 @@
-
+
@@ -62,7 +73,7 @@
-
+
@@ -71,7 +82,7 @@
-
+
diff --git a/WeChatPlugin/TKRemoteControlCommands.plist b/WeChatPlugin/TKRemoteControlCommands.plist
index b0bafc36..4a039a4c 100644
--- a/WeChatPlugin/TKRemoteControlCommands.plist
+++ b/WeChatPlugin/TKRemoteControlCommands.plist
@@ -7,7 +7,7 @@
executeCommand
open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app || open /System/Library/CoreServices/ScreenSaverEngine.app
keyword
- TK-PMBH
+ ScreenSave
function
屏幕保护
enable
@@ -17,7 +17,7 @@
executeCommand
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
keyword
- TK-SP
+ LockScreen
function
锁屏
enable
@@ -27,7 +27,7 @@
executeCommand
sleep
keyword
- TK-XM
+ Sleep
function
休眠
enable
@@ -37,7 +37,7 @@
executeCommand
shutdown
keyword
- TK-GJ
+ Shutdown
function
关机
enable
@@ -47,7 +47,7 @@
executeCommand
restart
keyword
- TK-CQ
+ Restart
function
重启
enable
@@ -57,7 +57,7 @@
executeCommand
empty
keyword
- TK-QK
+ EmptyTrash
function
清空废纸篓
enable
@@ -69,7 +69,7 @@
executeCommand
killQQ
keyword
- TK-QQ
+ KillQQ
function
退出 QQ
enable
@@ -79,7 +79,7 @@
executeCommand
killWeChat
keyword
- TK-WeChat
+ KillWeChat
function
退出 WeChat
enable
@@ -89,7 +89,7 @@
executeCommand
killChrome
keyword
- TK-Chrome
+ KillChrome
function
退出 Chrome
enable
@@ -99,7 +99,7 @@
executeCommand
killSafari
keyword
- TK-Safari
+ KillSafari
function
退出 Safari
enable
@@ -109,7 +109,7 @@
executeCommand
killAll
keyword
- TK-All
+ KillAll
function
退出所有程序
enable
@@ -121,61 +121,61 @@
executeCommand
musicToggle
keyword
- TK-Toggle
+ Toggle
function
播放/暂停
enable
-
+
executeCommand
musicNext
keyword
- TK-Next
+ Next
function
下一首
enable
-
+
executeCommand
musicPrevious
keyword
- TK-Previous
+ Previous
function
上一首
enable
-
+
executeCommand
musicVolumeUp
keyword
- TK-VolumeUp
+ VolumeUp
function
增大音量
enable
-
+
executeCommand
musicVolumeDown
keyword
- TK-VolumeDown
+ VolumeDown
function
减小音量
enable
-
+
executeCommand
musicLike
keyword
- TK-Like
+ LikeChange
function
喜欢/取消喜欢
enable
-
+