Skip to content

Commit

Permalink
Add ==> 新增语音远程控制 mac
Browse files Browse the repository at this point in the history
  • Loading branch information
TKkk-iOSer committed Mar 3, 2018
1 parent d1d24ae commit 52978ff
Show file tree
Hide file tree
Showing 19 changed files with 116 additions and 22 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# 更新日志

### [v1.5.1 (2018-03-03)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.5.1)

* 新增语音远程控制 mac
* 修复快捷回复后消息未读数未更新的问题
* 优化防撤回提醒 (显示撤回人昵称 & 消息类型)

### [v1.5.0 (2018-02-24)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.5.0)

* 优化防撤回提醒
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[];
- (id)SendTextMessage:(id)arg1 toUsrName:(id)arg2 msgText:(id)arg3 atUserList:(id)arg4;
- (id)GetMsgData:(id)arg1 svrId:(long)arg2;
- (void)AddLocalMsg:(id)arg1 msgData:(id)arg2;
- (void)TranscribeVoiceMessage:(id)arg1 completion:(void (^)(void))arg2;
- (BOOL)ClearUnRead:(id)arg1 FromID:(unsigned int)arg2 ToID:(unsigned int)arg3;
@end

@interface MMServiceCenter : NSObject
Expand All @@ -64,6 +66,7 @@ FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[];
@property(nonatomic, setter=SetMsgType:) int msgType; // @synthesize msgType;
@property(retain, nonatomic, setter=SetToUserName:) SKBuiltinString_t *toUserName; // @synthesize toUserName;
@property (nonatomic, assign) unsigned int createTime;
@property(nonatomic, setter=SetNewMsgId:) long long newMsgId;
@end

@interface MMChatsViewController : NSViewController <NSTableViewDataSource, NSTableViewDelegate>
Expand Down Expand Up @@ -99,6 +102,8 @@ FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[];
@property(nonatomic) int msgStatus;
@property(nonatomic) int msgCreateTime;
@property(nonatomic) int mesLocalID;
@property(nonatomic) long long mesSvrID;
@property(retain, nonatomic) NSString *msgVoiceText;
@property(copy, nonatomic) NSString *m_nsEmoticonMD5;
- (BOOL)isChatRoomMessage;
- (id)groupChatSenderDisplayName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.5.0</string>
<string>1.5.1</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand All @@ -41,6 +41,6 @@
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017年 tk. All rights reserved.</string>
<key>versionInfo</key>
<string>👉 优化防撤回提醒 \n👉🏻 新增自动登录开关 \n👉🏼 新增小助手检测更新 \n👉🏽 新增通知中心快捷回复 \n👉🏾 新增表情包复制 &amp; 存储 \n👉🏿 自动回复 &amp; 远程控制设置存储到本地 \n\n</string>
<string>👉 v1.5.1 (2018-03-03):\n新增语音远程控制 mac\n修复快捷回复后消息未读数未更新的问题\n优化防撤回提醒 (显示撤回人昵称 &amp; 消息类型) \n\n上版本更新内容(v1.5.0):\n👉🏻 新增自动登录开关 \n👉🏼 新增小助手检测更新 \n👉🏽 新增通知中心快捷回复 \n👉🏾 新增表情包复制 &amp; 存储 \n👉🏿 自动回复 &amp; 远程控制设置存储到本地 \n\n</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[];
- (id)SendTextMessage:(id)arg1 toUsrName:(id)arg2 msgText:(id)arg3 atUserList:(id)arg4;
- (id)GetMsgData:(id)arg1 svrId:(long)arg2;
- (void)AddLocalMsg:(id)arg1 msgData:(id)arg2;
- (void)TranscribeVoiceMessage:(id)arg1 completion:(void (^)(void))arg2;
- (BOOL)ClearUnRead:(id)arg1 FromID:(unsigned int)arg2 ToID:(unsigned int)arg3;
@end

@interface MMServiceCenter : NSObject
Expand All @@ -64,6 +66,7 @@ FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[];
@property(nonatomic, setter=SetMsgType:) int msgType; // @synthesize msgType;
@property(retain, nonatomic, setter=SetToUserName:) SKBuiltinString_t *toUserName; // @synthesize toUserName;
@property (nonatomic, assign) unsigned int createTime;
@property(nonatomic, setter=SetNewMsgId:) long long newMsgId;
@end

@interface MMChatsViewController : NSViewController <NSTableViewDataSource, NSTableViewDelegate>
Expand Down Expand Up @@ -99,6 +102,8 @@ FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[];
@property(nonatomic) int msgStatus;
@property(nonatomic) int msgCreateTime;
@property(nonatomic) int mesLocalID;
@property(nonatomic) long long mesSvrID;
@property(retain, nonatomic) NSString *msgVoiceText;
@property(copy, nonatomic) NSString *m_nsEmoticonMD5;
- (BOOL)isChatRoomMessage;
- (id)groupChatSenderDisplayName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.5.0</string>
<string>1.5.1</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand All @@ -41,6 +41,6 @@
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017年 tk. All rights reserved.</string>
<key>versionInfo</key>
<string>👉 优化防撤回提醒 \n👉🏻 新增自动登录开关 \n👉🏼 新增小助手检测更新 \n👉🏽 新增通知中心快捷回复 \n👉🏾 新增表情包复制 &amp; 存储 \n👉🏿 自动回复 &amp; 远程控制设置存储到本地 \n\n</string>
<string>👉 v1.5.1 (2018-03-03):\n新增语音远程控制 mac\n修复快捷回复后消息未读数未更新的问题\n优化防撤回提醒 (显示撤回人昵称 &amp; 消息类型) \n\n上版本更新内容(v1.5.0):\n👉🏻 新增自动登录开关 \n👉🏼 新增小助手检测更新 \n👉🏽 新增通知中心快捷回复 \n👉🏾 新增表情包复制 &amp; 存储 \n👉🏿 自动回复 &amp; 远程控制设置存储到本地 \n\n</string>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[];
- (id)SendTextMessage:(id)arg1 toUsrName:(id)arg2 msgText:(id)arg3 atUserList:(id)arg4;
- (id)GetMsgData:(id)arg1 svrId:(long)arg2;
- (void)AddLocalMsg:(id)arg1 msgData:(id)arg2;
- (void)TranscribeVoiceMessage:(id)arg1 completion:(void (^)(void))arg2;
- (BOOL)ClearUnRead:(id)arg1 FromID:(unsigned int)arg2 ToID:(unsigned int)arg3;
@end

@interface MMServiceCenter : NSObject
Expand All @@ -64,6 +66,7 @@ FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[];
@property(nonatomic, setter=SetMsgType:) int msgType; // @synthesize msgType;
@property(retain, nonatomic, setter=SetToUserName:) SKBuiltinString_t *toUserName; // @synthesize toUserName;
@property (nonatomic, assign) unsigned int createTime;
@property(nonatomic, setter=SetNewMsgId:) long long newMsgId;
@end

@interface MMChatsViewController : NSViewController <NSTableViewDataSource, NSTableViewDelegate>
Expand Down Expand Up @@ -99,6 +102,8 @@ FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[];
@property(nonatomic) int msgStatus;
@property(nonatomic) int msgCreateTime;
@property(nonatomic) int mesLocalID;
@property(nonatomic) long long mesSvrID;
@property(retain, nonatomic) NSString *msgVoiceText;
@property(copy, nonatomic) NSString *m_nsEmoticonMD5;
- (BOOL)isChatRoomMessage;
- (id)groupChatSenderDisplayName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.5.0</string>
<string>1.5.1</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
Expand All @@ -41,6 +41,6 @@
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017年 tk. All rights reserved.</string>
<key>versionInfo</key>
<string>👉 优化防撤回提醒 \n👉🏻 新增自动登录开关 \n👉🏼 新增小助手检测更新 \n👉🏽 新增通知中心快捷回复 \n👉🏾 新增表情包复制 &amp; 存储 \n👉🏿 自动回复 &amp; 远程控制设置存储到本地 \n\n</string>
<string>👉 v1.5.1 (2018-03-03):\n新增语音远程控制 mac\n修复快捷回复后消息未读数未更新的问题\n优化防撤回提醒 (显示撤回人昵称 &amp; 消息类型) \n\n上版本更新内容(v1.5.0):\n👉🏻 新增自动登录开关 \n👉🏼 新增小助手检测更新 \n👉🏽 新增通知中心快捷回复 \n👉🏾 新增表情包复制 &amp; 存储 \n👉🏿 自动回复 &amp; 远程控制设置存储到本地 \n\n</string>
</dict>
</plist>
Binary file not shown.
Binary file modified Other/Products/Debug/WeChatPlugin.framework/WeChatPlugin
Binary file not shown.
Binary file added Other/ScreenShots/voice_remote_control.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

## WeChatPlugin-MacOS

![platform](https://img.shields.io/badge/platform-macos-lightgrey.svg) [![release](https://img.shields.io/badge/release-v1.5.0-brightgreen.svg)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases) ![support](https://img.shields.io/badge/support-wechat%202.3.10-blue.svg) [![GitHub license](https://img.shields.io/github/license/TKkk-iOSer/WeChatPlugin-MacOS.svg)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/blob/master/LICENSE)
![platform](https://img.shields.io/badge/platform-macos-lightgrey.svg) [![release](https://img.shields.io/badge/release-v1.5.1-brightgreen.svg)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases) ![support](https://img.shields.io/badge/support-wechat%202.3.10-blue.svg) [![GitHub license](https://img.shields.io/github/license/TKkk-iOSer/WeChatPlugin-MacOS.svg)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/blob/master/LICENSE)



微信小助手 v1.5.0
微信小助手 v1.5.1

![微信小助手.png](./Other/ScreenShots/wechatplugin.png)

Expand All @@ -16,16 +15,17 @@
---

### 更新日志
* [新增语音远程控制mac & 优化撤回消息、快捷回复(2018-03-03)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.5.0)

[新增小助手检测更新&表情包复制存储等等 (2018-02-24)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.5.0)
* [新增小助手检测更新&表情包复制存储等等 (2018-02-24)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.5.0)

[新增窗口置顶&多选删除等等 (2017-10-11)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.4.0)
* [新增窗口置顶&多选删除等等 (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)
* [新增置底&免认证 (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)
* [修复聊天记录消失的bug (2017-09-11)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.2.0)

[重构自动回复,实现多回复 (2017-08-23)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.1.0)
* [重构自动回复,实现多回复 (2017-08-23)](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/releases/tag/v1.1.0)

**详细内容请查看**[CHANGELOG](https://github.com/TKkk-iOSer/WeChatPlugin-MacOS/blob/master/CHANGELOG.md)

Expand All @@ -34,7 +34,7 @@
### 功能
* 消息自动回复
* 消息防撤回
* 远程控制
* 远程控制(已支持语音)
* 微信多开
* 第二次登录免认证
* 聊天置底功能(~~类似置顶~~)
Expand Down Expand Up @@ -68,6 +68,7 @@
- [x] 完善消息防撤回(显示撤回用户昵称)
- [x] ~~清除微信缓存(官方已加)~~
- [x] 优化小助手设置(更新后保留相关设置,更新提醒)
- [x] 语音远程控制mac
- [ ] 群聊屏蔽某成员

---
Expand Down Expand Up @@ -95,6 +96,10 @@
* 聊天窗口表情复制 & 存储
<img src="./Other/ScreenShots/emotion_copy_export.png" height="400" hspace="50" />

* 语音远程控制
![语音远程控制](./Other/ScreenShots/voice_remote_control.gif)


---

### 安装
Expand All @@ -109,8 +114,7 @@

**1. 普通安装**

* 点击`clone or download`按钮下载 WeChatPlugin 至`下载`目录并解压到`下载`目录,打开Termimal,执行 `~/Downloads/WeChatPlugin-MacOS-master/Other/Install.sh`即可。

* 点击`clone or download`按钮下载 WeChatPlugin 并解压,打开Terminal(终端),拖动解压后`Install.sh` 文件(在 Other 文件夹中)到 Terminal 回车即可。

**2. 若想修改源码&重编译**

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,22 @@
<Bucket
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "WeChatPlugin/Sources/Category/WeChat+hook.m"
timestampString = "541762746.2122509"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "419"
endingLineNumber = "419"
landmarkName = "-hook_sendLogoutCGIWithCompletion:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
4 changes: 2 additions & 2 deletions WeChatPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.5.0</string>
<string>1.5.1</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017年 tk. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string></string>
<key>versionInfo</key>
<string>👉 优化防撤回提醒 \n👉🏻 新增自动登录开关 \n👉🏼 新增小助手检测更新 \n👉🏽 新增通知中心快捷回复 \n👉🏾 新增表情包复制 &amp; 存储 \n👉🏿 自动回复 &amp; 远程控制设置存储到本地 \n\n</string>
<string>👉 v1.5.1 (2018-03-03):\n新增语音远程控制 mac\n修复快捷回复后消息未读数未更新的问题\n优化防撤回提醒 (显示撤回人昵称 &amp; 消息类型) \n\n上版本更新内容(v1.5.0):\n👉🏻 新增自动登录开关 \n👉🏼 新增小助手检测更新 \n👉🏽 新增通知中心快捷回复 \n👉🏾 新增表情包复制 &amp; 存储 \n👉🏿 自动回复 &amp; 远程控制设置存储到本地 \n\n</string>
</dict>
</plist>
15 changes: 14 additions & 1 deletion WeChatPlugin/Sources/Category/WeChat+hook.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ + (void)addAssistantMenuItem {
// 登录新微信
NSMenuItem *newWeChatItem = [[NSMenuItem alloc] initWithTitle:@"登录新微信" action:@selector(onNewWechatInstance:) keyEquivalent:@"N"];
// 远程控制
NSMenuItem *commandItem = [[NSMenuItem alloc] initWithTitle:@"远程控制Mac OS" action:@selector(onRemoteControl:) keyEquivalent:@"C"];
NSMenuItem *commandItem = [[NSMenuItem alloc] initWithTitle:@"远程控制mac" action:@selector(onRemoteControl:) keyEquivalent:@"C"];
// 微信窗口置顶
NSMenuItem *onTopItem = [[NSMenuItem alloc] initWithTitle:@"微信窗口置顶" action:@selector(onWechatOnTopControl:) keyEquivalent:@"d"];
onTopItem.state = [[TKWeChatPluginConfig sharedConfig] onTop];
Expand Down Expand Up @@ -385,6 +385,7 @@ - (void)hook_userNotificationCenter:(id)notificationCenter didActivateNotificati
if ([instanceUserName isEqualToString:currentUserName]) {
MessageService *service = [[objc_getClass("MMServiceCenter") defaultCenter] getService:objc_getClass("MessageService")];
[service SendTextMessage:currentUserName toUsrName:chatName msgText:notification.response.string atUserList:nil];
[service ClearUnRead:chatName FromID:0 ToID:0];
}
} else {
[self hook_userNotificationCenter:notificationCenter didActivateNotification:notification];
Expand Down Expand Up @@ -545,6 +546,18 @@ - (void)autoReplyWithMsg:(AddMsg *)addMsg {
- (void)remoteControlWithMsg:(AddMsg *)addMsg {
if (addMsg.msgType == 1 || addMsg.msgType == 3) {
[TKRemoteControlController executeRemoteControlCommandWithMsg:addMsg.content.string];
} else if (addMsg.msgType == 34) {
// 此为语音消息
MessageService *msgService = [[objc_getClass("MMServiceCenter") defaultCenter] getService:objc_getClass("MessageService")];
MessageData *msgData = [msgService GetMsgData:addMsg.fromUserName.string svrId:addMsg.newMsgId];
long long mesSvrID = msgData.mesSvrID;
NSString *sessionName = msgData.fromUsrName;
[msgService TranscribeVoiceMessage:msgData completion:^ {
MessageData *callbackMsgData = [msgService GetMsgData:sessionName svrId:mesSvrID];
dispatch_async(dispatch_get_main_queue(), ^{
[TKRemoteControlController executeRemoteControlCommandWithVoiceMsg:callbackMsgData.msgVoiceText];
});
}];
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

@interface TKRemoteControlController : NSObject

+ (void)executeRemoteControlCommandWithVoiceMsg:(NSString *)msg;
+ (void)executeRemoteControlCommandWithMsg:(NSString *)msg;
+ (void)executeShellCommand:(NSString *)msg;
+ (NSString *)remoteControlCommandsString;
Expand Down
36 changes: 34 additions & 2 deletions WeChatPlugin/Sources/Controllers/TKRemoteControlController.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,34 @@
#import "TKRemoteControlModel.h"
#import "WeChatPlugin.h"

typedef NS_ENUM(NSUInteger, MessageDataType) {
MessageDataTypeText,
MessageDataTypeVoice
};

// 执行 AppleScript
static NSString * const kRemoteControlAppleScript = @"osascript /Applications/WeChat.app/Contents/MacOS/WeChatPlugin.framework/Resources/TKRemoteControlScript.scpt";

@implementation TKRemoteControlController

+ (void)executeRemoteControlCommandWithVoiceMsg:(NSString *)msg {
NSString *currentUserName = [objc_getClass("CUtility") GetCurrentUserName];
NSString *callBack = [NSString stringWithFormat:@"小助手收到一条语音消息,转文字后👇👇👇:\n\n\n%@",msg];
MessageService *service = [[objc_getClass("MMServiceCenter") defaultCenter] getService:objc_getClass("MessageService")];
[service SendTextMessage:currentUserName toUsrName:currentUserName msgText:callBack atUserList:nil];

[self executeRemoteControlCommandWithMsg:msg msgType:MessageDataTypeVoice];
}

+ (void)executeRemoteControlCommandWithMsg:(NSString *)msg {
[self executeRemoteControlCommandWithMsg:msg msgType:MessageDataTypeText];
}

+ (void)executeRemoteControlCommandWithMsg:(NSString *)msg msgType:(MessageDataType)type {
NSArray *remoteControlModels = [TKWeChatPluginConfig sharedConfig].remoteControlModels;
[remoteControlModels enumerateObjectsUsingBlock:^(NSArray *subModels, NSUInteger index, BOOL * _Nonnull stop) {
[subModels enumerateObjectsUsingBlock:^(TKRemoteControlModel *model, NSUInteger idx, BOOL * _Nonnull stop) {
if (model.enable && ![model.keyword isEqualToString:@""] && [msg isEqualToString:model.keyword]) {
[subModels enumerateObjectsUsingBlock:^(TKRemoteControlModel *model, NSUInteger idx, BOOL * _Nonnull subStop) {
if ([self sholdExecuteRemoteControlWithModel:model msg:msg msgType:type]) {
if ([model.function isEqualToString:@"屏幕保护"] || [model.function isEqualToString:@"锁屏"]) {
// 屏幕保护 & 锁屏 通过 Shell 命令来执行即可
[self executeShellCommand:model.executeCommand];
Expand All @@ -40,11 +58,25 @@ + (void)executeRemoteControlCommandWithMsg:(NSString *)msg {
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];
*stop = YES;
*subStop = YES;
}
}];
}];
}

+ (BOOL)sholdExecuteRemoteControlWithModel:(TKRemoteControlModel *)model msg:(NSString *)msg msgType:(MessageDataType)type {
if (model.enable && ![model.keyword isEqualToString:@""]) {
if ((type == MessageDataTypeText && [msg isEqualToString:model.keyword]) || (type == MessageDataTypeVoice && [msg containsString:model.keyword])) {
return YES;
} else {
return NO;
}
} else {
return NO;
}
}

/**
通过 NSTask 执行 Shell 命令
Expand Down
Loading

0 comments on commit 52978ff

Please sign in to comment.