diff --git a/WeChatPlugin.xcodeproj/project.pbxproj b/WeChatPlugin.xcodeproj/project.pbxproj index cae14601..92a82882 100644 --- a/WeChatPlugin.xcodeproj/project.pbxproj +++ b/WeChatPlugin.xcodeproj/project.pbxproj @@ -8,36 +8,58 @@ /* Begin PBXBuildFile section */ 528B4F971EA7383800BC6A89 /* WeChatPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 528B4F951EA7383800BC6A89 /* WeChatPlugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 528B4FAB1EA7386D00BC6A89 /* WeChat+hook.h in Headers */ = {isa = PBXBuildFile; fileRef = 528B4F9E1EA7386D00BC6A89 /* WeChat+hook.h */; }; - 528B4FAC1EA7386D00BC6A89 /* WeChat+hook.m in Sources */ = {isa = PBXBuildFile; fileRef = 528B4F9F1EA7386D00BC6A89 /* WeChat+hook.m */; }; - 528B4FAD1EA7386D00BC6A89 /* TKWeChatPluginConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 528B4FA11EA7386D00BC6A89 /* TKWeChatPluginConfig.h */; }; - 528B4FAE1EA7386D00BC6A89 /* TKWeChatPluginConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 528B4FA21EA7386D00BC6A89 /* TKWeChatPluginConfig.m */; }; - 528B4FAF1EA7386D00BC6A89 /* TKHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 528B4FA41EA7386D00BC6A89 /* TKHelper.h */; }; - 528B4FB01EA7386D00BC6A89 /* TKHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 528B4FA51EA7386D00BC6A89 /* TKHelper.m */; }; - 528B4FB11EA7386D00BC6A89 /* TKAutoReplyWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 528B4FA71EA7386D00BC6A89 /* TKAutoReplyWindowController.h */; }; - 528B4FB21EA7386D00BC6A89 /* TKAutoReplyWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 528B4FA81EA7386D00BC6A89 /* TKAutoReplyWindowController.m */; }; - 528B4FB31EA7386D00BC6A89 /* TKAutoReplyWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 528B4FA91EA7386D00BC6A89 /* TKAutoReplyWindowController.xib */; }; 528B4FB41EA7386D00BC6A89 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 528B4FAA1EA7386D00BC6A89 /* main.mm */; }; - 528B4FE51EA8695B00BC6A89 /* XMLReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 528B4FE31EA8695B00BC6A89 /* XMLReader.h */; }; - 528B4FE61EA8695B00BC6A89 /* XMLReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 528B4FE41EA8695B00BC6A89 /* XMLReader.m */; }; + 52B5CEF21F3B4623000D9DD9 /* TKRemoteControlCommands.plist in Resources */ = {isa = PBXBuildFile; fileRef = 52B5CEF01F3B4623000D9DD9 /* TKRemoteControlCommands.plist */; }; + 52B5CEF31F3B4623000D9DD9 /* TKRemoteControlScript.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 52B5CEF11F3B4623000D9DD9 /* TKRemoteControlScript.scpt */; }; + 52B5CF121F3B4631000D9DD9 /* WeChat+hook.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B5CEF61F3B4631000D9DD9 /* WeChat+hook.h */; }; + 52B5CF131F3B4631000D9DD9 /* WeChat+hook.m in Sources */ = {isa = PBXBuildFile; fileRef = 52B5CEF71F3B4631000D9DD9 /* WeChat+hook.m */; }; + 52B5CF141F3B4631000D9DD9 /* TKWeChatPluginConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B5CEF91F3B4631000D9DD9 /* TKWeChatPluginConfig.h */; }; + 52B5CF151F3B4631000D9DD9 /* TKWeChatPluginConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 52B5CEFA1F3B4631000D9DD9 /* TKWeChatPluginConfig.m */; }; + 52B5CF161F3B4631000D9DD9 /* TKRemoteControlController.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B5CEFC1F3B4631000D9DD9 /* TKRemoteControlController.h */; }; + 52B5CF171F3B4631000D9DD9 /* TKRemoteControlController.m in Sources */ = {isa = PBXBuildFile; fileRef = 52B5CEFD1F3B4631000D9DD9 /* TKRemoteControlController.m */; }; + 52B5CF181F3B4631000D9DD9 /* TKRemoteControlModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B5CEFF1F3B4631000D9DD9 /* TKRemoteControlModel.h */; }; + 52B5CF191F3B4631000D9DD9 /* TKRemoteControlModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 52B5CF001F3B4631000D9DD9 /* TKRemoteControlModel.m */; }; + 52B5CF1A1F3B4631000D9DD9 /* TKHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B5CF021F3B4631000D9DD9 /* TKHelper.h */; }; + 52B5CF1B1F3B4631000D9DD9 /* TKHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 52B5CF031F3B4631000D9DD9 /* TKHelper.m */; }; + 52B5CF1C1F3B4631000D9DD9 /* XMLReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B5CF041F3B4631000D9DD9 /* XMLReader.h */; }; + 52B5CF1D1F3B4631000D9DD9 /* XMLReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 52B5CF051F3B4631000D9DD9 /* XMLReader.m */; }; + 52B5CF1E1F3B4631000D9DD9 /* TKRemoteControlCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B5CF071F3B4631000D9DD9 /* TKRemoteControlCell.h */; }; + 52B5CF1F1F3B4631000D9DD9 /* TKRemoteControlCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 52B5CF081F3B4631000D9DD9 /* TKRemoteControlCell.m */; }; + 52B5CF201F3B4631000D9DD9 /* TKAutoReplyWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B5CF0B1F3B4631000D9DD9 /* TKAutoReplyWindowController.h */; }; + 52B5CF211F3B4631000D9DD9 /* TKAutoReplyWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 52B5CF0C1F3B4631000D9DD9 /* TKAutoReplyWindowController.m */; }; + 52B5CF221F3B4631000D9DD9 /* TKAutoReplyWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 52B5CF0D1F3B4631000D9DD9 /* TKAutoReplyWindowController.xib */; }; + 52B5CF231F3B4631000D9DD9 /* TKRemoteControlWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 52B5CF0F1F3B4631000D9DD9 /* TKRemoteControlWindowController.h */; }; + 52B5CF241F3B4631000D9DD9 /* TKRemoteControlWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 52B5CF101F3B4631000D9DD9 /* TKRemoteControlWindowController.m */; }; + 52B5CF251F3B4631000D9DD9 /* TKRemoteControlWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 52B5CF111F3B4631000D9DD9 /* TKRemoteControlWindowController.xib */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 528B4F921EA7383800BC6A89 /* WeChatPlugin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WeChatPlugin.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 528B4F951EA7383800BC6A89 /* WeChatPlugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WeChatPlugin.h; sourceTree = ""; }; 528B4F961EA7383800BC6A89 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 528B4F9E1EA7386D00BC6A89 /* WeChat+hook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "WeChat+hook.h"; sourceTree = ""; }; - 528B4F9F1EA7386D00BC6A89 /* WeChat+hook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "WeChat+hook.m"; sourceTree = ""; }; - 528B4FA11EA7386D00BC6A89 /* TKWeChatPluginConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKWeChatPluginConfig.h; sourceTree = ""; }; - 528B4FA21EA7386D00BC6A89 /* TKWeChatPluginConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKWeChatPluginConfig.m; sourceTree = ""; }; - 528B4FA41EA7386D00BC6A89 /* TKHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKHelper.h; sourceTree = ""; }; - 528B4FA51EA7386D00BC6A89 /* TKHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKHelper.m; sourceTree = ""; }; - 528B4FA71EA7386D00BC6A89 /* TKAutoReplyWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKAutoReplyWindowController.h; sourceTree = ""; }; - 528B4FA81EA7386D00BC6A89 /* TKAutoReplyWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKAutoReplyWindowController.m; sourceTree = ""; }; - 528B4FA91EA7386D00BC6A89 /* TKAutoReplyWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TKAutoReplyWindowController.xib; sourceTree = ""; }; 528B4FAA1EA7386D00BC6A89 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; - 528B4FE31EA8695B00BC6A89 /* XMLReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLReader.h; sourceTree = ""; }; - 528B4FE41EA8695B00BC6A89 /* XMLReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XMLReader.m; sourceTree = ""; }; + 52B5CEF01F3B4623000D9DD9 /* TKRemoteControlCommands.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = TKRemoteControlCommands.plist; sourceTree = ""; }; + 52B5CEF11F3B4623000D9DD9 /* TKRemoteControlScript.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; path = TKRemoteControlScript.scpt; sourceTree = ""; }; + 52B5CEF61F3B4631000D9DD9 /* WeChat+hook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "WeChat+hook.h"; sourceTree = ""; }; + 52B5CEF71F3B4631000D9DD9 /* WeChat+hook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "WeChat+hook.m"; sourceTree = ""; }; + 52B5CEF91F3B4631000D9DD9 /* TKWeChatPluginConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKWeChatPluginConfig.h; sourceTree = ""; }; + 52B5CEFA1F3B4631000D9DD9 /* TKWeChatPluginConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKWeChatPluginConfig.m; sourceTree = ""; }; + 52B5CEFC1F3B4631000D9DD9 /* TKRemoteControlController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKRemoteControlController.h; sourceTree = ""; }; + 52B5CEFD1F3B4631000D9DD9 /* TKRemoteControlController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKRemoteControlController.m; sourceTree = ""; }; + 52B5CEFF1F3B4631000D9DD9 /* TKRemoteControlModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKRemoteControlModel.h; sourceTree = ""; }; + 52B5CF001F3B4631000D9DD9 /* TKRemoteControlModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKRemoteControlModel.m; sourceTree = ""; }; + 52B5CF021F3B4631000D9DD9 /* TKHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKHelper.h; sourceTree = ""; }; + 52B5CF031F3B4631000D9DD9 /* TKHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKHelper.m; sourceTree = ""; }; + 52B5CF041F3B4631000D9DD9 /* XMLReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLReader.h; sourceTree = ""; }; + 52B5CF051F3B4631000D9DD9 /* XMLReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XMLReader.m; sourceTree = ""; }; + 52B5CF071F3B4631000D9DD9 /* TKRemoteControlCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKRemoteControlCell.h; sourceTree = ""; }; + 52B5CF081F3B4631000D9DD9 /* TKRemoteControlCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKRemoteControlCell.m; sourceTree = ""; }; + 52B5CF0B1F3B4631000D9DD9 /* TKAutoReplyWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKAutoReplyWindowController.h; sourceTree = ""; }; + 52B5CF0C1F3B4631000D9DD9 /* TKAutoReplyWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKAutoReplyWindowController.m; sourceTree = ""; }; + 52B5CF0D1F3B4631000D9DD9 /* TKAutoReplyWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TKAutoReplyWindowController.xib; sourceTree = ""; }; + 52B5CF0F1F3B4631000D9DD9 /* TKRemoteControlWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKRemoteControlWindowController.h; sourceTree = ""; }; + 52B5CF101F3B4631000D9DD9 /* TKRemoteControlWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKRemoteControlWindowController.m; sourceTree = ""; }; + 52B5CF111F3B4631000D9DD9 /* TKRemoteControlWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TKRemoteControlWindowController.xib; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -70,54 +92,121 @@ 528B4F941EA7383800BC6A89 /* WeChatPlugin */ = { isa = PBXGroup; children = ( - 528B4F9D1EA7386D00BC6A89 /* Category */, - 528B4FA01EA7386D00BC6A89 /* Config */, - 528B4FA31EA7386D00BC6A89 /* Util */, - 528B4FA61EA7386D00BC6A89 /* WindowController */, + 52B5CEF41F3B4631000D9DD9 /* Sources */, + 52B5CEEF1F3B45ED000D9DD9 /* Supporting Files */, + ); + path = WeChatPlugin; + sourceTree = ""; + }; + 52B5CEEF1F3B45ED000D9DD9 /* Supporting Files */ = { + isa = PBXGroup; + children = ( 528B4FAA1EA7386D00BC6A89 /* main.mm */, 528B4F951EA7383800BC6A89 /* WeChatPlugin.h */, 528B4F961EA7383800BC6A89 /* Info.plist */, + 52B5CEF01F3B4623000D9DD9 /* TKRemoteControlCommands.plist */, + 52B5CEF11F3B4623000D9DD9 /* TKRemoteControlScript.scpt */, ); - path = WeChatPlugin; + name = "Supporting Files"; sourceTree = ""; }; - 528B4F9D1EA7386D00BC6A89 /* Category */ = { + 52B5CEF41F3B4631000D9DD9 /* Sources */ = { isa = PBXGroup; children = ( - 528B4F9E1EA7386D00BC6A89 /* WeChat+hook.h */, - 528B4F9F1EA7386D00BC6A89 /* WeChat+hook.m */, + 52B5CEF51F3B4631000D9DD9 /* Category */, + 52B5CEF81F3B4631000D9DD9 /* Config */, + 52B5CEFB1F3B4631000D9DD9 /* Controllers */, + 52B5CEFE1F3B4631000D9DD9 /* Models */, + 52B5CF011F3B4631000D9DD9 /* Utils */, + 52B5CF061F3B4631000D9DD9 /* Views */, + 52B5CF091F3B4631000D9DD9 /* WindowControllers */, + ); + path = Sources; + sourceTree = ""; + }; + 52B5CEF51F3B4631000D9DD9 /* Category */ = { + isa = PBXGroup; + children = ( + 52B5CEF61F3B4631000D9DD9 /* WeChat+hook.h */, + 52B5CEF71F3B4631000D9DD9 /* WeChat+hook.m */, ); path = Category; sourceTree = ""; }; - 528B4FA01EA7386D00BC6A89 /* Config */ = { + 52B5CEF81F3B4631000D9DD9 /* Config */ = { isa = PBXGroup; children = ( - 528B4FA11EA7386D00BC6A89 /* TKWeChatPluginConfig.h */, - 528B4FA21EA7386D00BC6A89 /* TKWeChatPluginConfig.m */, + 52B5CEF91F3B4631000D9DD9 /* TKWeChatPluginConfig.h */, + 52B5CEFA1F3B4631000D9DD9 /* TKWeChatPluginConfig.m */, ); path = Config; sourceTree = ""; }; - 528B4FA31EA7386D00BC6A89 /* Util */ = { + 52B5CEFB1F3B4631000D9DD9 /* Controllers */ = { + isa = PBXGroup; + children = ( + 52B5CEFC1F3B4631000D9DD9 /* TKRemoteControlController.h */, + 52B5CEFD1F3B4631000D9DD9 /* TKRemoteControlController.m */, + ); + path = Controllers; + sourceTree = ""; + }; + 52B5CEFE1F3B4631000D9DD9 /* Models */ = { + isa = PBXGroup; + children = ( + 52B5CEFF1F3B4631000D9DD9 /* TKRemoteControlModel.h */, + 52B5CF001F3B4631000D9DD9 /* TKRemoteControlModel.m */, + ); + path = Models; + sourceTree = ""; + }; + 52B5CF011F3B4631000D9DD9 /* Utils */ = { + isa = PBXGroup; + children = ( + 52B5CF021F3B4631000D9DD9 /* TKHelper.h */, + 52B5CF031F3B4631000D9DD9 /* TKHelper.m */, + 52B5CF041F3B4631000D9DD9 /* XMLReader.h */, + 52B5CF051F3B4631000D9DD9 /* XMLReader.m */, + ); + path = Utils; + sourceTree = ""; + }; + 52B5CF061F3B4631000D9DD9 /* Views */ = { isa = PBXGroup; children = ( - 528B4FE31EA8695B00BC6A89 /* XMLReader.h */, - 528B4FE41EA8695B00BC6A89 /* XMLReader.m */, - 528B4FA41EA7386D00BC6A89 /* TKHelper.h */, - 528B4FA51EA7386D00BC6A89 /* TKHelper.m */, + 52B5CF071F3B4631000D9DD9 /* TKRemoteControlCell.h */, + 52B5CF081F3B4631000D9DD9 /* TKRemoteControlCell.m */, ); - path = Util; + path = Views; sourceTree = ""; }; - 528B4FA61EA7386D00BC6A89 /* WindowController */ = { + 52B5CF091F3B4631000D9DD9 /* WindowControllers */ = { isa = PBXGroup; children = ( - 528B4FA71EA7386D00BC6A89 /* TKAutoReplyWindowController.h */, - 528B4FA81EA7386D00BC6A89 /* TKAutoReplyWindowController.m */, - 528B4FA91EA7386D00BC6A89 /* TKAutoReplyWindowController.xib */, + 52B5CF0A1F3B4631000D9DD9 /* AutoReplyWindowController */, + 52B5CF0E1F3B4631000D9DD9 /* RemoteControlWindowController */, ); - path = WindowController; + path = WindowControllers; + sourceTree = ""; + }; + 52B5CF0A1F3B4631000D9DD9 /* AutoReplyWindowController */ = { + isa = PBXGroup; + children = ( + 52B5CF0B1F3B4631000D9DD9 /* TKAutoReplyWindowController.h */, + 52B5CF0C1F3B4631000D9DD9 /* TKAutoReplyWindowController.m */, + 52B5CF0D1F3B4631000D9DD9 /* TKAutoReplyWindowController.xib */, + ); + path = AutoReplyWindowController; + sourceTree = ""; + }; + 52B5CF0E1F3B4631000D9DD9 /* RemoteControlWindowController */ = { + isa = PBXGroup; + children = ( + 52B5CF0F1F3B4631000D9DD9 /* TKRemoteControlWindowController.h */, + 52B5CF101F3B4631000D9DD9 /* TKRemoteControlWindowController.m */, + 52B5CF111F3B4631000D9DD9 /* TKRemoteControlWindowController.xib */, + ); + path = RemoteControlWindowController; sourceTree = ""; }; /* End PBXGroup section */ @@ -127,12 +216,16 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 528B4FB11EA7386D00BC6A89 /* TKAutoReplyWindowController.h in Headers */, - 528B4FE51EA8695B00BC6A89 /* XMLReader.h in Headers */, 528B4F971EA7383800BC6A89 /* WeChatPlugin.h in Headers */, - 528B4FAB1EA7386D00BC6A89 /* WeChat+hook.h in Headers */, - 528B4FAD1EA7386D00BC6A89 /* TKWeChatPluginConfig.h in Headers */, - 528B4FAF1EA7386D00BC6A89 /* TKHelper.h in Headers */, + 52B5CF1A1F3B4631000D9DD9 /* TKHelper.h in Headers */, + 52B5CF1C1F3B4631000D9DD9 /* XMLReader.h in Headers */, + 52B5CF161F3B4631000D9DD9 /* TKRemoteControlController.h in Headers */, + 52B5CF121F3B4631000D9DD9 /* WeChat+hook.h in Headers */, + 52B5CF231F3B4631000D9DD9 /* TKRemoteControlWindowController.h in Headers */, + 52B5CF181F3B4631000D9DD9 /* TKRemoteControlModel.h in Headers */, + 52B5CF201F3B4631000D9DD9 /* TKAutoReplyWindowController.h in Headers */, + 52B5CF141F3B4631000D9DD9 /* TKWeChatPluginConfig.h in Headers */, + 52B5CF1E1F3B4631000D9DD9 /* TKRemoteControlCell.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -195,7 +288,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 528B4FB31EA7386D00BC6A89 /* TKAutoReplyWindowController.xib in Resources */, + 52B5CF251F3B4631000D9DD9 /* TKRemoteControlWindowController.xib in Resources */, + 52B5CEF21F3B4623000D9DD9 /* TKRemoteControlCommands.plist in Resources */, + 52B5CF221F3B4631000D9DD9 /* TKAutoReplyWindowController.xib in Resources */, + 52B5CEF31F3B4623000D9DD9 /* TKRemoteControlScript.scpt in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -222,12 +318,16 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 528B4FB21EA7386D00BC6A89 /* TKAutoReplyWindowController.m in Sources */, - 528B4FAC1EA7386D00BC6A89 /* WeChat+hook.m in Sources */, - 528B4FAE1EA7386D00BC6A89 /* TKWeChatPluginConfig.m in Sources */, - 528B4FB01EA7386D00BC6A89 /* TKHelper.m in Sources */, - 528B4FE61EA8695B00BC6A89 /* XMLReader.m in Sources */, + 52B5CF241F3B4631000D9DD9 /* TKRemoteControlWindowController.m in Sources */, + 52B5CF211F3B4631000D9DD9 /* TKAutoReplyWindowController.m in Sources */, + 52B5CF151F3B4631000D9DD9 /* TKWeChatPluginConfig.m in Sources */, + 52B5CF131F3B4631000D9DD9 /* WeChat+hook.m in Sources */, + 52B5CF1B1F3B4631000D9DD9 /* TKHelper.m in Sources */, + 52B5CF171F3B4631000D9DD9 /* TKRemoteControlController.m in Sources */, + 52B5CF1F1F3B4631000D9DD9 /* TKRemoteControlCell.m in Sources */, + 52B5CF191F3B4631000D9DD9 /* TKRemoteControlModel.m in Sources */, 528B4FB41EA7386D00BC6A89 /* main.mm in Sources */, + 52B5CF1D1F3B4631000D9DD9 /* XMLReader.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -384,6 +484,7 @@ 528B4F9C1EA7383800BC6A89 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/WeChatPlugin.xcodeproj/project.xcworkspace/xcuserdata/TK.xcuserdatad/UserInterfaceState.xcuserstate b/WeChatPlugin.xcodeproj/project.xcworkspace/xcuserdata/TK.xcuserdatad/UserInterfaceState.xcuserstate index 1f0f926f..54198973 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/Category/WeChat+hook.m b/WeChatPlugin/Category/WeChat+hook.m deleted file mode 100644 index 648b4167..00000000 --- a/WeChatPlugin/Category/WeChat+hook.m +++ /dev/null @@ -1,199 +0,0 @@ -// -// WeChat+hook.m -// WeChatPlugin -// -// Created by TK on 2017/4/19. -// Copyright © 2017年 tk. All rights reserved. -// - -#import "WeChat+hook.h" -#import "WeChatPlugin.h" -#import "TKAutoReplyWindowController.h" -#import "XMLReader.h" - -static char tkAutoReplyWindowControllerKey; // 自动回复窗口的关联 key - -@implementation NSObject (WeChatHook) - -+ (void)hookWeChat { - - // 微信用户登录/退出 - tk_hookMethod(objc_getClass("MMMainWindowController"), @selector(onAuthOK), [self class], @selector(hook_onAuthOK)); - tk_hookMethod(objc_getClass("MMMainWindowController"), @selector(onLogOut), [self class], @selector(hook_onLogOut)); - - // 微信撤回消息 - tk_hookMethod(objc_getClass("MessageService"), @selector(onRevokeMsg:), [self class], @selector(hook_onRevokeMsg:)); - - // 微信消息同步 - tk_hookMethod(objc_getClass("MessageService"), @selector(OnSyncBatchAddMsgs:isFirstSync:), [self class], @selector(hook_OnSyncBatchAddMsgs:isFirstSync:)); - -} -/** - hook 用户退出登录 - - */ -- (void)hook_onLogOut { - NSMenu *helpIMenu = [NSApplication sharedApplication].helpMenu; - while (helpIMenu.itemArray.count > 1) { - [helpIMenu removeItemAtIndex:helpIMenu.itemArray.count - 1]; - } - - [self hook_onLogOut]; -} - -/** - hook 用户登录 - - */ -- (void)hook_onAuthOK { - NSMenu *helpIMenu = [NSApplication sharedApplication].helpMenu; - if (helpIMenu.itemArray.count == 1) { - NSMenuItem *preventRevokeItem = [[NSMenuItem alloc] initWithTitle:@"开启消息防撤回" action:@selector(onPreventRevoke:) keyEquivalent:@"t"]; - preventRevokeItem.state = [[TKWeChatPluginConfig sharedConfig] preventRevokeEnable]; - NSMenuItem *autoReplyItem = [[NSMenuItem alloc] initWithTitle:@"开启自动回复" action:@selector(onAutoReply:) keyEquivalent:@"k"]; - autoReplyItem.state = [[TKWeChatPluginConfig sharedConfig] autoReplyEnable]; - - [helpIMenu addItem:[NSMenuItem separatorItem]]; - [helpIMenu addItem:preventRevokeItem]; - [helpIMenu addItem:autoReplyItem]; - } - - [self hook_onAuthOK]; -} - -/** - hook 微信撤回消息 - - */ -- (void)hook_onRevokeMsg:(id)msg { - if (msg && [[TKWeChatPluginConfig sharedConfig] preventRevokeEnable]) { - // 转换群聊的 msg - NSString *msgContent = [msg substringFromIndex:[msg rangeOfString:@" 180) { // 若是3分钟前的消息,则不进行自动回复与远程控制。 + return; + } + + if ([addMsg.fromUserName.string containsString:@"@chatroom"]) { // 过滤群聊消息 + return ; + } + + ContactStorage *contactStorage = [[objc_getClass("MMServiceCenter") defaultCenter] getService:objc_getClass("ContactStorage")]; + WCContactData *selfContact = [contactStorage GetSelfContact]; + + if ([addMsg.fromUserName.string isEqualToString:selfContact.m_nsUsrName]) { + if ([addMsg.toUserName.string isEqualToString:selfContact.m_nsUsrName]) { + [self remoteControlWithMsg:addMsg]; + } + } else { + [self autoReplyWithMsg:addMsg]; + } + }]; +} + +#pragma mark - Other +/** + 自动回复 + + @param msg 接收的消息 + */ +- (void)autoReplyWithMsg:(AddMsg *)msg { + if( ![[TKWeChatPluginConfig sharedConfig] autoReplyEnable]) return; + + if (msg.msgType == 1 || msg.msgType == 3) { + MessageService *service = [[objc_getClass("MMServiceCenter") defaultCenter] getService:objc_getClass("MessageService")]; + // NSString *content = addMsg.content.string; + // if ([addMsg.fromUserName.string containsString:@"@chatroom"]) { + // NSRange range = [addMsg.content.string rangeOfString:@":\n"]; + // if (range.length != 0) { + // content = [addMsg.content.string substringFromIndex:range.location + range.length]; + // } + // } + ContactStorage *contactStorage = [[objc_getClass("MMServiceCenter") defaultCenter] getService:objc_getClass("ContactStorage")]; + WCContactData *selfContact = [contactStorage GetSelfContact]; + + NSString *keyword = [[TKWeChatPluginConfig sharedConfig] autoReplyKeyword]; + if ([keyword isEqualToString:@""] || [msg.content.string isEqualToString:keyword]) { + [service SendTextMessage:selfContact.m_nsUsrName toUsrName:msg.fromUserName.string msgText:[[TKWeChatPluginConfig sharedConfig] autoReplyText] atUserList:nil]; + } + } +} + +/** + 远程控制 + + @param msg 接收的消息 + */ +- (void)remoteControlWithMsg:(AddMsg *)msg { + + if (msg.msgType == 1 || msg.msgType == 3) { + [TKRemoteControlController executeRemoteControlCommandWithMsg:msg.content.string]; + } +} + +@end diff --git a/WeChatPlugin/Config/TKWeChatPluginConfig.h b/WeChatPlugin/Sources/Config/TKWeChatPluginConfig.h similarity index 83% rename from WeChatPlugin/Config/TKWeChatPluginConfig.h rename to WeChatPlugin/Sources/Config/TKWeChatPluginConfig.h index f6a1d991..ce57150e 100644 --- a/WeChatPlugin/Config/TKWeChatPluginConfig.h +++ b/WeChatPlugin/Sources/Config/TKWeChatPluginConfig.h @@ -10,11 +10,13 @@ @interface TKWeChatPluginConfig : NSObject -+ (instancetype)sharedConfig; - @property (nonatomic, assign) BOOL preventRevokeEnable; /**< 是否开启防撤回 */ @property (nonatomic, assign) BOOL autoReplyEnable; /**< 是否开启自动回复 */ @property (nonatomic, copy) NSString *autoReplyKeyword; /**< 自动回复关键字 */ @property (nonatomic, copy) NSString *autoReplyText; /**< 自动回复的内容 */ +@property (nonatomic, copy) NSArray *remoteControlModels; /**< 远程控制的数组 */ + +- (void)saveRemoteControlModels; ++ (instancetype)sharedConfig; @end diff --git a/WeChatPlugin/Config/TKWeChatPluginConfig.m b/WeChatPlugin/Sources/Config/TKWeChatPluginConfig.m similarity index 57% rename from WeChatPlugin/Config/TKWeChatPluginConfig.m rename to WeChatPlugin/Sources/Config/TKWeChatPluginConfig.m index 2a1912ca..dde5a409 100644 --- a/WeChatPlugin/Config/TKWeChatPluginConfig.m +++ b/WeChatPlugin/Sources/Config/TKWeChatPluginConfig.m @@ -7,11 +7,13 @@ // #import "TKWeChatPluginConfig.h" +#import "TKRemoteControlModel.h" static NSString * const kTKPreventRevokeEnableKey = @"kTKPreventRevokeEnableKey"; static NSString * const kTKAutoReplyEnableKey = @"kTKAutoReplyEnableKey"; static NSString * const kTKAutoReplyKeywordKey = @"kTKAutoReplyKeywordKey"; static NSString * const kTKAutoReplyTextKey = @"kTKAutoReplyTextKey"; +static NSString * const kTKRemoteControlModelsFilePath = @"/Applications/WeChat.app/Contents/MacOS/WeChatPlugin.framework/Resources/TKRemoteControlCommands.plist"; @implementation TKWeChatPluginConfig @@ -60,4 +62,36 @@ - (void)setAutoReplyText:(NSString *)autoReplyText { [[NSUserDefaults standardUserDefaults] synchronize]; } +- (NSArray *)remoteControlModels { + if (!_remoteControlModels) { + _remoteControlModels = ({ + NSArray *originModels = [NSArray arrayWithContentsOfFile:kTKRemoteControlModelsFilePath]; + NSMutableArray *newRemoteControlModels = [NSMutableArray array]; + [originModels enumerateObjectsUsingBlock:^(NSArray *subModels, NSUInteger idx, BOOL * _Nonnull stop) { + NSMutableArray *newSubModels = [NSMutableArray array]; + [subModels enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + TKRemoteControlModel *model = [[TKRemoteControlModel alloc] initWithDict:obj]; + [newSubModels addObject:model]; + }]; + [newRemoteControlModels addObject:newSubModels]; + }]; + + newRemoteControlModels; + }); + } + return _remoteControlModels; +} + +- (void)saveRemoteControlModels { + NSMutableArray *needSaveModels = [NSMutableArray array]; + [_remoteControlModels enumerateObjectsUsingBlock:^(NSArray *subModels, NSUInteger idx, BOOL * _Nonnull stop) { + NSMutableArray *newSubModels = [NSMutableArray array]; + [subModels enumerateObjectsUsingBlock:^(TKRemoteControlModel *obj, NSUInteger idx, BOOL * _Nonnull stop) { + [newSubModels addObject:obj.dictionary]; + }]; + [needSaveModels addObject:newSubModels]; + }]; + [needSaveModels writeToFile:kTKRemoteControlModelsFilePath atomically:YES]; +} + @end diff --git a/WeChatPlugin/Sources/Controllers/TKRemoteControlController.h b/WeChatPlugin/Sources/Controllers/TKRemoteControlController.h new file mode 100644 index 00000000..b1a21f1b --- /dev/null +++ b/WeChatPlugin/Sources/Controllers/TKRemoteControlController.h @@ -0,0 +1,16 @@ +// +// TKRemoteControlController.h +// WeChatPlugin +// +// Created by TK on 2017/8/8. +// Copyright © 2017年 tk. All rights reserved. +// + +#import + +@interface TKRemoteControlController : NSObject + ++ (void)executeRemoteControlCommandWithMsg:(NSString *)msg; ++ (void)executeShellCommand:(NSString *)msg; + +@end diff --git a/WeChatPlugin/Sources/Controllers/TKRemoteControlController.m b/WeChatPlugin/Sources/Controllers/TKRemoteControlController.m new file mode 100644 index 00000000..4c5337f9 --- /dev/null +++ b/WeChatPlugin/Sources/Controllers/TKRemoteControlController.m @@ -0,0 +1,58 @@ +// +// TKRemoteControlController.m +// WeChatPlugin +// +// Created by TK on 2017/8/8. +// Copyright © 2017年 tk. All rights reserved. +// + +#import "TKRemoteControlController.h" +#import "TKWeChatPluginConfig.h" +#import "TKRemoteControlModel.h" + +// 执行 AppleScript +static NSString * const kRemoteControlAppleScript = @"osascript /Applications/WeChat.app/Contents/MacOS/WeChatPlugin.framework/Resources/TKRemoteControlScript.scpt"; + +@implementation TKRemoteControlController + ++ (void)executeRemoteControlCommandWithMsg:(NSString *)msg { + 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]) { + if ([model.function isEqualToString:@"屏幕保护"]) { + // 屏幕保护通过 Shell 命令来执行即可 + [self executeShellCommand:model.executeCommand]; + } else if ([model.function isEqualToString:@"锁屏"]) { + // 屏幕保护通过 Shell 命令来执行即可 + [self executeShellCommand:model.executeCommand]; + } else { + // 拼接相关参数,执行 AppleScript + NSString *command = [NSString stringWithFormat:@"%@ %@",kRemoteControlAppleScript, model.executeCommand]; + [self executeShellCommand:command]; + // bug: 有些程序在第一次时会无法关闭,需要再次关闭 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if ([model.function isEqualToString:@"退出所有程序"]) { + NSString *command = [NSString stringWithFormat:@"%@ %@",kRemoteControlAppleScript, model.executeCommand]; + [self executeShellCommand:command]; + } + }); + } + } + }]; + }]; +} + +/** + 通过 NSTask 执行 Shell 命令 + + @param cmd Terminal命令 + */ ++ (void)executeShellCommand:(NSString *)cmd { + NSTask *task = [[NSTask alloc] init]; + [task setLaunchPath:@"/bin/bash"]; + [task setArguments:@[@"-c", cmd]]; + [task launch]; +} + +@end diff --git a/WeChatPlugin/Sources/Models/TKRemoteControlModel.h b/WeChatPlugin/Sources/Models/TKRemoteControlModel.h new file mode 100644 index 00000000..0b3a5ee2 --- /dev/null +++ b/WeChatPlugin/Sources/Models/TKRemoteControlModel.h @@ -0,0 +1,21 @@ +// +// TKRemoteControlModel.h +// WeChatPlugin +// +// Created by TK on 2017/8/8. +// Copyright © 2017年 tk. All rights reserved. +// + +#import + +@interface TKRemoteControlModel : NSObject + +@property (nonatomic, assign) BOOL enable; +@property (nonatomic, copy) NSString *keyword; +@property (nonatomic, copy) NSString *function; +@property (nonatomic, copy) NSString *executeCommand; + +- (instancetype)initWithDict:(NSDictionary *)dict; +- (NSDictionary *)dictionary; + +@end diff --git a/WeChatPlugin/Sources/Models/TKRemoteControlModel.m b/WeChatPlugin/Sources/Models/TKRemoteControlModel.m new file mode 100644 index 00000000..27d1943c --- /dev/null +++ b/WeChatPlugin/Sources/Models/TKRemoteControlModel.m @@ -0,0 +1,31 @@ +// +// TKRemoteControlModel.m +// WeChatPlugin +// +// Created by TK on 2017/8/8. +// Copyright © 2017年 tk. All rights reserved. +// + +#import "TKRemoteControlModel.h" + +@implementation TKRemoteControlModel + +- (instancetype)initWithDict:(NSDictionary *)dict { + self = [super init]; + if (self) { + self.enable = [dict[@"enable"] boolValue]; + self.keyword = dict[@"keyword"]; + self.function = dict[@"function"]; + self.executeCommand = dict[@"executeCommand"]; + } + return self; +} + +- (NSDictionary *)dictionary { + return @{@"enable": @(self.enable), + @"keyword": self.keyword, + @"function": self.function, + @"executeCommand": self.executeCommand}; +} + +@end diff --git a/WeChatPlugin/Util/TKHelper.h b/WeChatPlugin/Sources/Utils/TKHelper.h similarity index 100% rename from WeChatPlugin/Util/TKHelper.h rename to WeChatPlugin/Sources/Utils/TKHelper.h diff --git a/WeChatPlugin/Util/TKHelper.m b/WeChatPlugin/Sources/Utils/TKHelper.m similarity index 100% rename from WeChatPlugin/Util/TKHelper.m rename to WeChatPlugin/Sources/Utils/TKHelper.m diff --git a/WeChatPlugin/Util/XMLReader.h b/WeChatPlugin/Sources/Utils/XMLReader.h similarity index 100% rename from WeChatPlugin/Util/XMLReader.h rename to WeChatPlugin/Sources/Utils/XMLReader.h diff --git a/WeChatPlugin/Util/XMLReader.m b/WeChatPlugin/Sources/Utils/XMLReader.m similarity index 100% rename from WeChatPlugin/Util/XMLReader.m rename to WeChatPlugin/Sources/Utils/XMLReader.m diff --git a/WeChatPlugin/Sources/Views/TKRemoteControlCell.h b/WeChatPlugin/Sources/Views/TKRemoteControlCell.h new file mode 100644 index 00000000..c7d5fe27 --- /dev/null +++ b/WeChatPlugin/Sources/Views/TKRemoteControlCell.h @@ -0,0 +1,15 @@ +// +// TKRemoteControlCell.h +// WeChatPlugin +// +// Created by TK on 2017/8/8. +// Copyright © 2017年 tk. All rights reserved. +// + +#import + +@interface TKRemoteControlCell : NSView + +- (void)setupWithData:(id)data; + +@end diff --git a/WeChatPlugin/Sources/Views/TKRemoteControlCell.m b/WeChatPlugin/Sources/Views/TKRemoteControlCell.m new file mode 100644 index 00000000..cd0240dc --- /dev/null +++ b/WeChatPlugin/Sources/Views/TKRemoteControlCell.m @@ -0,0 +1,73 @@ +// +// TKRemoteControlCell.m +// WeChatPlugin +// +// Created by TK on 2017/8/8. +// Copyright © 2017年 tk. All rights reserved. +// + +#import "TKRemoteControlCell.h" +#import "TKRemoteControlModel.h" + +@interface TKRemoteControlCell () + +@property (nonatomic, strong) NSButton *selectBtn; +@property (nonatomic, strong) NSTextField *textField; +@property (nonatomic, strong) TKRemoteControlModel *model; + +@end + +@implementation TKRemoteControlCell + +- (instancetype)init { + self = [super init]; + if (self) { + [self initSubviews]; + } + return self; +} + +- (void)initSubviews { + self.selectBtn = ({ + NSButton *btn = [NSButton checkboxWithTitle:@"" target:self action:@selector(clickSelectBtn:)]; + btn.frame = NSMakeRect(50, 10, 150, 30); + + btn; + }); + + self.textField = ({ + NSTextField *v = [[NSTextField alloc] init]; + v.frame = NSMakeRect(200, 10, 250, 30); + v.placeholderString = @"请输入匹配的关键词"; + v.layer.cornerRadius = 10; + v.layer.masksToBounds = YES; + [v.layer setNeedsDisplay]; + v.editable = YES; + v.delegate = self; + + v; + }); + + [self addSubview:self.selectBtn]; + [self addSubview:self.textField]; +} + +- (void)clickSelectBtn:(NSButton *)btn { + self.model.enable = btn.state; +} + +- (void)setupWithData:(id)data { + TKRemoteControlModel *model = data; + self.model = model; + self.selectBtn.title = model.function; + self.selectBtn.state = model.enable; + self.textField.stringValue = model.keyword; +} + +- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor { + NSString *string = control.stringValue; + self.model.keyword = string; + return YES; +} + +@end diff --git a/WeChatPlugin/WindowController/TKAutoReplyWindowController.h b/WeChatPlugin/Sources/WindowControllers/AutoReplyWindowController/TKAutoReplyWindowController.h similarity index 100% rename from WeChatPlugin/WindowController/TKAutoReplyWindowController.h rename to WeChatPlugin/Sources/WindowControllers/AutoReplyWindowController/TKAutoReplyWindowController.h diff --git a/WeChatPlugin/WindowController/TKAutoReplyWindowController.m b/WeChatPlugin/Sources/WindowControllers/AutoReplyWindowController/TKAutoReplyWindowController.m similarity index 100% rename from WeChatPlugin/WindowController/TKAutoReplyWindowController.m rename to WeChatPlugin/Sources/WindowControllers/AutoReplyWindowController/TKAutoReplyWindowController.m diff --git a/WeChatPlugin/WindowController/TKAutoReplyWindowController.xib b/WeChatPlugin/Sources/WindowControllers/AutoReplyWindowController/TKAutoReplyWindowController.xib similarity index 96% rename from WeChatPlugin/WindowController/TKAutoReplyWindowController.xib rename to WeChatPlugin/Sources/WindowControllers/AutoReplyWindowController/TKAutoReplyWindowController.xib index 9229929f..d7656911 100644 --- a/WeChatPlugin/WindowController/TKAutoReplyWindowController.xib +++ b/WeChatPlugin/Sources/WindowControllers/AutoReplyWindowController/TKAutoReplyWindowController.xib @@ -1,8 +1,8 @@ - + - + @@ -17,7 +17,7 @@ - + diff --git a/WeChatPlugin/Sources/WindowControllers/RemoteControlWindowController/TKRemoteControlWindowController.h b/WeChatPlugin/Sources/WindowControllers/RemoteControlWindowController/TKRemoteControlWindowController.h new file mode 100644 index 00000000..6be7f71a --- /dev/null +++ b/WeChatPlugin/Sources/WindowControllers/RemoteControlWindowController/TKRemoteControlWindowController.h @@ -0,0 +1,13 @@ +// +// TKRemoteControlWindowController.h +// WeChatPlugin +// +// Created by TK on 2017/8/8. +// Copyright © 2017年 tk. All rights reserved. +// + +#import + +@interface TKRemoteControlWindowController : NSWindowController + +@end diff --git a/WeChatPlugin/Sources/WindowControllers/RemoteControlWindowController/TKRemoteControlWindowController.m b/WeChatPlugin/Sources/WindowControllers/RemoteControlWindowController/TKRemoteControlWindowController.m new file mode 100644 index 00000000..fb916852 --- /dev/null +++ b/WeChatPlugin/Sources/WindowControllers/RemoteControlWindowController/TKRemoteControlWindowController.m @@ -0,0 +1,94 @@ +// +// TKRemoteControlWindowController.m +// WeChatPlugin +// +// Created by TK on 2017/8/8. +// Copyright © 2017年 tk. All rights reserved. +// + +#import "TKRemoteControlWindowController.h" +#import "TKRemoteControlModel.h" +#import "TKWeChatPluginConfig.h" +#import "TKRemoteControlCell.h" + +@interface TKRemoteControlWindowController () + +@property (weak) IBOutlet NSTabView *tabView; +@property (nonatomic, strong) NSTableView *tableView; +@property (nonatomic, strong) NSArray *remoteControlModels; + +@end + +@implementation TKRemoteControlWindowController + +- (void)windowDidLoad { + [super windowDidLoad]; + + [self setup]; + [self initSubviews]; +} + +- (void)initSubviews { + + CGFloat tabViewWidth = self.tabView.frame.size.width; + CGFloat tabViewHeight = self.tabView.frame.size.height; + + self.tableView = ({ + NSTableView *tableView = [[NSTableView alloc] init]; + tableView.frame = NSMakeRect(50, 50, tabViewWidth, tabViewHeight); + tableView.delegate = self; + tableView.dataSource = self; + NSTableColumn *column = [[NSTableColumn alloc] init]; + column.width = tabViewWidth - 100; + [tableView addTableColumn:column]; + tableView.selectionHighlightStyle = NSTableViewSelectionHighlightStyleNone; + tableView.backgroundColor = [NSColor clearColor]; + + tableView; + }); + + [self.tabView addSubview:self.tableView]; +} + +- (void)setup { + self.window.contentView.layer.backgroundColor = [NSColor whiteColor].CGColor; + [self.window.contentView.layer setNeedsDisplay]; + self.remoteControlModels = [[TKWeChatPluginConfig sharedConfig] remoteControlModels][0]; +} + +/** + 关闭窗口时间 + + */ +- (BOOL)windowShouldClose:(id)sender { + [[TKWeChatPluginConfig sharedConfig] saveRemoteControlModels]; + return YES; +} + +#pragma mark - NSTableViewDataSource && NSTableViewDelegate + +- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView{ + return self.remoteControlModels.count; +} + +- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row{ + TKRemoteControlCell *cell = [[TKRemoteControlCell alloc] init]; + cell.frame = NSMakeRect(0, 0, self.tabView.frame.size.width, 40); + [cell setupWithData:self.remoteControlModels[row]]; + + return cell; +} + +- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row{ + return 50; +} + +#pragma mark - NSTabViewDelegate + +- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem { + NSInteger selectTabIndex = [tabViewItem.identifier integerValue]; + self.remoteControlModels = [[TKWeChatPluginConfig sharedConfig] remoteControlModels][selectTabIndex]; + [self.tableView reloadData]; +} + +@end diff --git a/WeChatPlugin/Sources/WindowControllers/RemoteControlWindowController/TKRemoteControlWindowController.xib b/WeChatPlugin/Sources/WindowControllers/RemoteControlWindowController/TKRemoteControlWindowController.xib new file mode 100644 index 00000000..50017c37 --- /dev/null +++ b/WeChatPlugin/Sources/WindowControllers/RemoteControlWindowController/TKRemoteControlWindowController.xib @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WeChatPlugin/TKRemoteControlCommands.plist b/WeChatPlugin/TKRemoteControlCommands.plist new file mode 100644 index 00000000..6d82ded1 --- /dev/null +++ b/WeChatPlugin/TKRemoteControlCommands.plist @@ -0,0 +1,182 @@ + + + + + + + executeCommand + open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app + keyword + TK-PMBH + function + 屏幕保护 + enable + + + + executeCommand + /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend + keyword + TK-SP + function + 锁屏 + enable + + + + executeCommand + sleep + keyword + TK-XM + function + 休眠 + enable + + + + executeCommand + shutdown + keyword + TK-GJ + function + 关机 + enable + + + + executeCommand + restart + keyword + TK-CQ + function + 重启 + enable + + + + executeCommand + empty + keyword + TK-QK + function + 清空废纸篓 + enable + + + + + + executeCommand + killQQ + keyword + TK-QQ + function + 退出 QQ + enable + + + + executeCommand + killWeChat + keyword + TK-WeChat + function + 退出 WeChat + enable + + + + executeCommand + killChrome + keyword + TK-Chrome + function + 退出 Chrome + enable + + + + executeCommand + killSafari + keyword + TK-Safari + function + 退出 Safari + enable + + + + executeCommand + killAll + keyword + TK-All + function + 退出所有程序 + enable + + + + + + executeCommand + musicPlay + keyword + TK-Play + function + 播放 + enable + + + + executeCommand + musicPause + keyword + TK-Pause + function + 暂停 + enable + + + + executeCommand + musicPrevious + keyword + TK-Previous + function + 上一首 + enable + + + + executeCommand + musicNext + keyword + TK-Next + function + 下一首 + enable + + + + executeCommand + musicLike + keyword + TK-Like + function + 喜欢歌曲 + enable + + + + executeCommand + musicUnLike + keyword + TK-Unlike + function + 取消喜欢 + enable + + + + + diff --git a/WeChatPlugin/TKRemoteControlScript.scpt b/WeChatPlugin/TKRemoteControlScript.scpt new file mode 100644 index 00000000..9aa6870b Binary files /dev/null and b/WeChatPlugin/TKRemoteControlScript.scpt differ diff --git a/WeChatPlugin/WeChatPlugin.h b/WeChatPlugin/WeChatPlugin.h index 13c4705e..317f1261 100644 --- a/WeChatPlugin/WeChatPlugin.h +++ b/WeChatPlugin/WeChatPlugin.h @@ -13,10 +13,6 @@ FOUNDATION_EXPORT double WeChatPluginVersionNumber; FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[]; -#define SCREEN_WIDTH ([NSScreen mainScreen].frame.size.width) -#define SCREEN_HEIGHT ([NSScreen mainScreen].frame.size.height) - - #pragma mark - 微信原始的部分类与方法 @interface MMMainWindowController : NSObject @@ -46,6 +42,7 @@ FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[]; @property(retain, nonatomic, setter=SetFromUserName:) SKBuiltinString_t *fromUserName; // @synthesize fromUserName; @property(nonatomic, setter=SetMsgType:) int msgType; // @synthesize msgType; @property(retain, nonatomic, setter=SetToUserName:) SKBuiltinString_t *toUserName; // @synthesize toUserName; +@property (nonatomic, assign) unsigned int createTime; @end @interface WeChat : NSObject @@ -63,10 +60,14 @@ FOUNDATION_EXPORT const unsigned char WeChatPluginVersionString[]; @interface MessageData : NSObject - (id)initWithMsgType:(long long)arg1; @property(retain, nonatomic) NSString *fromUsrName; -@property(retain, nonatomic) NSString *toUsrName; +@property(retain, nonatomic) NSString *toUsrName; @property(retain, nonatomic) NSString *msgContent; @property(retain, nonatomic) NSString *msgPushContent; @property(nonatomic) int msgStatus; @property(nonatomic) int msgCreateTime; @property(nonatomic) int mesLocalID; @end + +@interface CUtility : NSObject ++ (BOOL)HasWechatInstance; +@end