Compare commits

...

36 Commits

Author SHA1 Message Date
Sunny Young
1eee214417 Replace using Xcode's embedded Info.plist 2024-07-20 16:16:09 +08:00
Sunny Young
df0ffb2550 Fix deprecated warnings 2024-07-20 16:11:46 +08:00
Sunny Young
850dc6d1b1 Update build settings 2024-07-20 16:08:25 +08:00
Sunny Young
724c217710 Version bump to 1.5.0(25) 2024-03-25 10:22:42 +08:00
Sunny Young
d4eba24e4a Update Makefile 2024-03-25 10:22:42 +08:00
Sunny Young
8b3dcc24a0 Add location type message menu tweaks
Add open in Google Maps and Amap menu item
2024-03-25 10:22:42 +08:00
Sunny Young
e2300d8edb Update build settings 2024-03-25 10:22:42 +08:00
Zongle Wang
5bf1f8a62d Fix brew installation step in README EN 2024-03-03 11:23:21 +08:00
Sunny Young
3c6f1cbe66 Update README.md 2023-09-10 14:55:16 +08:00
Sunny Young
3a8c581c5e Version bump to 1.4.1(24) 2023-09-02 14:33:59 +08:00
Sunny Young
5d82b85a0f Fix a recalled message overwritten issue 2023-09-02 14:33:36 +08:00
Sunny Young
65e6346f03 Update build settings 2023-09-02 13:59:51 +08:00
jkhnfk
ad0cd57059 Update default.js
支持最新版本微信。
2023-07-14 19:43:42 +08:00
Sunny Young
02e2100c8f Update README.md 2023-07-14 17:12:00 +08:00
Sunny Young
c8178e3121 Version bump to 1.4.0(23) 2023-07-13 15:24:47 +08:00
Sunny Young
ddf9e51acd Fix support for WeChat 3.8.1 2023-07-13 15:08:49 +08:00
Sunny Young
f72f4c3f77 Version bump to 1.3.5(22) 2023-06-11 17:29:19 +08:00
Sunny Young
3b56f88758 Fix support for WeChat 3.8.0 2023-06-11 17:28:43 +08:00
Sunny Young
fe77da4ae8 Version bump to 1.3.4(21) 2023-04-29 22:01:49 +08:00
Sunny Young
676ebff036 Add missing preferences localizations 2023-04-28 18:21:06 +08:00
Sunny Young
3685d28592 Add custom mask color support 2023-04-28 17:41:24 +08:00
Sunny Young
46315d09d1 Version bump to 1.3.3(20) 2023-04-28 15:28:51 +08:00
Sunny Young
9bf679f8f7 Fix a multiple instances issue 2023-04-28 15:28:20 +08:00
Sunny Young
673bc4da2f Version bump to 1.3.2(19) 2023-04-28 11:11:50 +08:00
Sunny Young
2606dcf88c Compatible with WeChat 3.7.1
1. Upgrade dependencies
2. Update project settings
3. Remvoe classic revoked message style
2023-04-28 11:11:18 +08:00
Sunnyyoung
0b8de8dc63 Update README.md 2022-08-27 13:31:48 +08:00
Sunnyyoung
b700a8a3e2 Version bump to 1.3.1(18) 2022-04-19 18:53:06 +08:00
Sunnyyoung
86662c93e0 #486 Update fishhook
aadc161ac3
2022-04-19 18:51:54 +08:00
Sunnyyoung
91ec77f85d Upgrade CocoaPods 2022-04-19 18:48:07 +08:00
Sunnyyoung
8eb08dbd61 Version bump to 1.3.0(17) 2022-03-21 13:01:40 +08:00
Sunnyyoung
f6482b1d96 #451 #455 Refactor Alfred module
1. Remove Alfred workflow Python dependency
2. Remove Alfred JSON compressing
2022-03-21 13:01:09 +08:00
Sunnyyoung
82e7f6e113 Update build settings 2022-03-20 23:11:38 +08:00
Sunnyyoung
81755cb2af Update README.md 2022-03-18 09:45:11 +08:00
Sunnyyoung
1a3f58ef1b Version bump to 1.2.5(16) 2022-02-09 19:19:35 +08:00
Sunnyyoung
64e4febabd Fix #427 #428 2022-02-09 18:29:42 +08:00
Sunnyyoung
fc82ea965c Fix anti-revoke message cell mask style issue
Again
2022-02-07 22:35:18 +08:00
37 changed files with 520 additions and 1037 deletions

1
.gitignore vendored
View File

@ -143,4 +143,5 @@ fastlane/FastlaneRunner
### Project ###
Gems
WeChatTweak.xcarchive
WeChatTweak.framework

View File

@ -1 +1 @@
2.7.5
2.7.8

View File

@ -1,30 +1,38 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.5)
CFPropertyList (3.0.7)
base64
nkf
rexml
activesupport (6.1.4.4)
activesupport (7.1.3.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
base64 (0.2.0)
bigdecimal (3.1.8)
claide (1.1.0)
cocoapods (1.11.2)
cocoapods (1.15.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.11.2)
cocoapods-core (= 1.15.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.4.0, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
@ -32,10 +40,10 @@ GEM
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 1.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-core (1.11.2)
activesupport (>= 5.0, < 7)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.15.2)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
@ -45,7 +53,7 @@ GEM
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.5.1)
cocoapods-downloader (2.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
@ -54,38 +62,43 @@ GEM
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.1.9)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
drb (2.2.1)
escape (0.0.4)
ethon (0.15.0)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.15.5)
ffi (1.17.0)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.9.1)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
json (2.6.1)
minitest (5.15.0)
json (2.7.2)
minitest (5.24.1)
molinillo (0.8.0)
mutex_m (0.2.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
public_suffix (4.0.6)
rexml (3.2.5)
nkf (0.2.0)
public_suffix (4.0.7)
rexml (3.2.9)
strscan
ruby-macho (2.5.1)
typhoeus (1.4.0)
strscan (3.1.0)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.4)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.21.0)
xcodeproj (1.24.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.5.4)
PLATFORMS
ruby
@ -94,4 +107,4 @@ DEPENDENCIES
cocoapods
BUNDLED WITH
2.3.6
2.4.19

View File

@ -1,21 +1,24 @@
APP_PATH=/Applications/WeChat.app/Contents/MacOS
TMP_PATH=/tmp
APP_NAME=WeChat
BACKUP_NAME=WeChat.bak
FRAMEWORK_PATH=WeChatTweak.framework
FRAMEWORK_NAME=WeChatTweak
DYLIB_NAME=WeChatTweak.dylib
debug::
DYLD_INSERT_LIBRARIES=${FRAMEWORK_PATH}/${FRAMEWORK_NAME} ${APP_PATH}/${APP_NAME} &
xcodebuild build \
-workspace WeChatTweak.xcworkspace \
-scheme WeChatTweak \
-configuration Debug
DYLD_INSERT_LIBRARIES=WeChatTweak.framework/WeChatTweak /Applications/WeChat.app/Contents/MacOS/WeChat &
release::
xcodebuild archive \
-workspace WeChatTweak.xcworkspace \
-scheme WeChatTweak \
-destination 'generic/platform=macOS' \
-archivePath WeChatTweak.xcarchive
clean::
rm -rf ${FRAMEWORK_PATH}
rm -rf WeChatTweak.xcarchive WeChatTweak.framework
install::
@echo "Makefile installation has been deprecated!!!"
@echo "For more information: \033[33;32mhttps://github.com/Sunnyyoung/WeChatTweak-CLI\033[0m."
@echo "For more information: \033[33;32mhttps://github.com/sunnyyoung/WeChatTweak-CLI\033[0m."
uninstall::
@echo "Makefile installation has been deprecated!!!"
@echo "For more information: \033[33;32mhttps://github.com/Sunnyyoung/WeChatTweak-CLI\033[0m."
@echo "For more information: \033[33;32mhttps://github.com/sunnyyoung/WeChatTweak-CLI\033[0m."

View File

@ -1,16 +1,17 @@
platform :osx, '10.10'
platform :macos, '10.13'
inhibit_all_warnings!
target 'WeChatTweak' do
pod 'JRSwizzle'
pod 'GCDWebServer'
pod 'YYModel'
pod 'fishhook', :podspec => 'fishhook.podspec'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = 10.11
config.build_settings.delete 'ARCHS'
config.build_settings.delete 'MACOSX_DEPLOYMENT_TARGET'
end
end
end

View File

@ -1,26 +1,29 @@
PODS:
- fishhook (0.2)
- GCDWebServer (3.5.4):
- GCDWebServer/Core (= 3.5.4)
- GCDWebServer/Core (3.5.4)
- JRSwizzle (1.0)
- YYModel (1.0.4)
- JRSwizzle (2.0.0)
DEPENDENCIES:
- fishhook (from `fishhook.podspec`)
- GCDWebServer
- JRSwizzle
- YYModel
SPEC REPOS:
trunk:
- GCDWebServer
- JRSwizzle
- YYModel
EXTERNAL SOURCES:
fishhook:
:podspec: fishhook.podspec
SPEC CHECKSUMS:
fishhook: 415495c4be055473f437f0755286ae99e22d18da
GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
JRSwizzle: dd5ead5d913a0f29e7f558200165849f006bb1e3
YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30
JRSwizzle: 7a6fdfe05231e2de26eb14835622d4c6c20c0b6c
PODFILE CHECKSUM: 2d627cca174f5b93185d7b4603c19b06c0bd86a0
PODFILE CHECKSUM: 2882fbedfd770003d6828a279714d6ce0ef9a985
COCOAPODS: 1.11.2
COCOAPODS: 1.15.2

View File

@ -7,6 +7,8 @@
A dynamic library tweak for WeChat macOS.
![Overview](Screenshot/overview.jpg)
## Features
- Anti message revoked
@ -23,6 +25,7 @@ A dynamic library tweak for WeChat macOS.
- Support opened by the system default browser directly
- ~~Auto login without authentication~~ (Already supported by official)
- UI Interface settings panel
- Raycast extension support
- Alfred workflow support
- Launchbar action support
@ -30,30 +33,16 @@ A dynamic library tweak for WeChat macOS.
Install command line tool [WeChatTweak-CLI](https://github.com/Sunnyyoung/WeChatTweak-CLI):
```bash
$ brew tap sunnyyoung/repo/wechattweak-cli
```
```bash
brew install sunnyyoung/repo/wechattweak-cli
```
Install/Upgrade/Uninstall Tweak:
```bash
$ sudo wechattweak-cli install # Install/Uninstall
$ sudo wechattweak-cli uninstall # Uninstall
```
## Screenshots
### Overview
![Overview](Screenshot/0x01.png)
### Alfred workflow
![Alfred](Screenshot/0x02.png)
### LaunchBar action
![LaunchBar](Screenshot/0x03.png)
```bash
sudo wechattweak-cli install # Install/Uninstall
sudo wechattweak-cli uninstall # Uninstall
```
## References

View File

@ -7,6 +7,8 @@
微信 macOS 客户端增强 Tweak 动态库。
![Overview](Screenshot/overview.jpg)
## 功能
- 阻止消息撤回
@ -23,6 +25,7 @@
- 支持由系统默认浏览器直接打开
- ~~重新打开应用无需手机认证~~(官方已经支持)
- UI界面设置面板
- 支持 Raycast extension
- 支持 Alfred workflow
- 支持 Launchbar action
@ -30,46 +33,40 @@
**首次使用**安装 [WeChatTweak-CLI](https://github.com/Sunnyyoung/WeChatTweak-CLI):
```bash
$ brew install sunnyyoung/repo/wechattweak-cli
```
```bash
brew install sunnyyoung/repo/wechattweak-cli
```
安装/更新/卸载 Tweak:
```bash
$ sudo wechattweak-cli install # 安装/更新
$ sudo wechattweak-cli uninstall # 卸载
```
## 截图
### 整体预览
![Overview](Screenshot/0x01.png)
### Alfred workflow
![Alfred](Screenshot/0x02.png)
### LaunchBar action
![LaunchBar](Screenshot/0x03.png)
```bash
sudo wechattweak-cli install # 安装/更新
sudo wechattweak-cli uninstall # 卸载
```
## FAQ
1. 功能失效?
- 安装失败?
1. 请检查本地网络是否畅通。
2. 请检查是否安装了最新版本 WeChat 客户端,官网 & App Store 版本均可尝试。
3. 请检查 Terminal app 是否有正确的权限配置。
- 功能失效?
请提交 **issue** 然后等待,或提交 **pull request** 一起发电。
2. Issue 没有响应 or 回复?
- Issue 没有响应 or 回复?
开源项目,用爱发电,耐心等。
3. 兼容旧版本客户端吗?
不,为了降低维护成本和保证更新速度,默认只支持 **最新 App Store** 版本客户端。
4. 会封号吗?
- 兼容旧版本客户端吗?
不,为了降低维护成本和保证更新速度,默认只支持**最新**版本客户端。
- 会封号吗?
在**只使用该工具**的情况下**没有**出现过封号/风险提示,若有**使用过其他同类工具**则有可能会出现封号/风险提示,因此风险自负。
5. 安装出现 `codesign_allocate helper tool cannot be found or used` 错误?
- 安装出现 `codesign_allocate helper tool cannot be found or used` 错误?
该错误为系统问题,暂未清楚原因,一般情况下重新执行安装操作即可。
6. 安装完打开微信客户端提示 `没有权限打开应用程序`
先卸载,再重新安装一次即可,如仍无法解决请重启电脑。实在搞不定的,到 [issues](https://github.com/Sunnyyoung/WeChatTweak-macOS/issues?q=) 里找找类似问题并尝试解决。
7. 理性讨论。
- 安装完打开微信客户端提示 `没有权限打开应用程序`
先卸载,再重新安装一次即可,如仍无法解决请重启电脑。实在搞不定的,到 [issues](https://github.com/sunnyyoung/WeChatTweak-macOS/issues) 里找找类似问题并尝试解决。
- 截图失效?
系统偏好设置 -> 隐私 -> 删除微信并重新添加 -> 重启微信客户端。
- 出现`“WeChat.app” cannot be opened because the developer cannot be verified.`怎么办?
进入 `WeChat.app` 所在目录,通过右键菜单打开。
- 理性讨论。
## 参考

Binary file not shown.

Before

Width:  |  Height:  |  Size: 520 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

BIN
Screenshot/overview.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 KiB

Binary file not shown.

View File

@ -16,17 +16,25 @@ function run(string) {
return [];
}
return result.data.map(function (i) {
return {
title: i.m_nsRemark || i.m_nsNickName,
subtitle: i.m_nsNickName,
icon: i.wt_avatarPath || 'icon.png',
var arr=[];
var jsonArr=result.data.items;
jsonArr.forEach(function (i) {
arr.push( {
title: i.title,
subtitle: i.subtitle,
icon: i.icon.path,
action: "open",
actionArgument: i.m_nsUsrName
}
actionArgument: i.arg
})
});
// return JSON.stringify(result.data);
return arr;
}
function open(id) {
LaunchBar.hide()
HTTP.get('http://localhost:48065/wechat/start?session=' + id);
}
}

View File

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 56;
objects = {
/* Begin PBXBuildFile section */
@ -13,12 +13,9 @@
7D54A05C20E74D9400CB5306 /* TweakPreferencesController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7D54A05E20E74D9400CB5306 /* TweakPreferencesController.xib */; };
7D54A06A20E74FE500CB5306 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7D54A06C20E74FE500CB5306 /* Localizable.strings */; };
7D64150827A9469900A8A398 /* ContextMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150627A9469900A8A398 /* ContextMenu.m */; };
7D64150A27A9481C00A8A398 /* ContactData.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150927A9481C00A8A398 /* ContactData.m */; };
7D64150C27A94B9600A8A398 /* Directory.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150B27A94B9600A8A398 /* Directory.m */; };
7D64150E27A94BEA00A8A398 /* MultipleInstances.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150D27A94BEA00A8A398 /* MultipleInstances.m */; };
7D64151027A94DE200A8A398 /* PreferencesWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D64150F27A94DE200A8A398 /* PreferencesWindow.m */; };
7D9049F51F82A41A004E6370 /* fishhook.c in Sources */ = {isa = PBXBuildFile; fileRef = 7D9049F31F82A415004E6370 /* fishhook.c */; };
7D9049F61F82A41A004E6370 /* fishhook.h in Headers */ = {isa = PBXBuildFile; fileRef = 7D9049F41F82A415004E6370 /* fishhook.h */; };
7DF8422C1F40583F00D42D79 /* WeChatTweak.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DF8422A1F40583F00D42D79 /* WeChatTweak.h */; settings = {ATTRIBUTES = (Public, ); }; };
7DF842341F4058AB00D42D79 /* WeChatTweak.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DF842331F4058AB00D42D79 /* WeChatTweak.m */; };
7DF842521F4058C600D42D79 /* TweakPreferencesController.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DF8424F1F4058C600D42D79 /* TweakPreferencesController.h */; };
@ -27,11 +24,11 @@
7DF8425C1F4058DD00D42D79 /* NSBundle+WeChatTweak.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DF842581F4058DD00D42D79 /* NSBundle+WeChatTweak.m */; };
7DF842601F40590500D42D79 /* WeChatTweakHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DF8425F1F40590500D42D79 /* WeChatTweakHeaders.h */; };
7DF842651F40594400D42D79 /* Prefs-Tweak.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 7DF842641F40594400D42D79 /* Prefs-Tweak.tiff */; };
D84599A16A2504BCF95DB436 /* libPods-WeChatTweak.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 153504EC5C9196C0D85213CF /* libPods-WeChatTweak.a */; };
8F57F4CE7792FAE70DE20B02 /* libPods-WeChatTweak.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 015D5D0AC81B469FA2FF78F2 /* libPods-WeChatTweak.a */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
153504EC5C9196C0D85213CF /* libPods-WeChatTweak.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-WeChatTweak.a"; sourceTree = BUILT_PRODUCTS_DIR; };
015D5D0AC81B469FA2FF78F2 /* libPods-WeChatTweak.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-WeChatTweak.a"; sourceTree = BUILT_PRODUCTS_DIR; };
7D14E5A21F6447DB00D75132 /* Alfred.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Alfred.h; sourceTree = "<group>"; };
7D14E5A31F6447DB00D75132 /* Alfred.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Alfred.m; sourceTree = "<group>"; };
7D2194CA264701950068F4CC /* AntiRevoke.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AntiRevoke.m; sourceTree = "<group>"; };
@ -40,18 +37,14 @@
7D54A07120E7535F00CB5306 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
7D54A07220E7536300CB5306 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
7D64150627A9469900A8A398 /* ContextMenu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContextMenu.m; sourceTree = "<group>"; };
7D64150927A9481C00A8A398 /* ContactData.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContactData.m; sourceTree = "<group>"; };
7D64150B27A94B9600A8A398 /* Directory.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Directory.m; sourceTree = "<group>"; };
7D64150D27A94BEA00A8A398 /* MultipleInstances.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MultipleInstances.m; sourceTree = "<group>"; };
7D64150F27A94DE200A8A398 /* PreferencesWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PreferencesWindow.m; sourceTree = "<group>"; };
7D64B96727853C2100A07164 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/TweakPreferencesController.strings; sourceTree = "<group>"; };
7D64B96827853C2800A07164 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/TweakPreferencesController.strings"; sourceTree = "<group>"; };
7D64B96927853C2B00A07164 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/TweakPreferencesController.strings"; sourceTree = "<group>"; };
7D9049F31F82A415004E6370 /* fishhook.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fishhook.c; sourceTree = "<group>"; };
7D9049F41F82A415004E6370 /* fishhook.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fishhook.h; sourceTree = "<group>"; };
7DAE1DD727E828960009C01E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/TweakPreferencesController.strings; sourceTree = "<group>"; };
7DAE1DD927E828A50009C01E /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/TweakPreferencesController.strings"; sourceTree = "<group>"; };
7DAE1DDB27E828B00009C01E /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/TweakPreferencesController.strings"; sourceTree = "<group>"; };
7DF842271F40583F00D42D79 /* WeChatTweak.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WeChatTweak.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7DF8422A1F40583F00D42D79 /* WeChatTweak.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WeChatTweak.h; sourceTree = "<group>"; };
7DF8422B1F40583F00D42D79 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
7DF842331F4058AB00D42D79 /* WeChatTweak.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WeChatTweak.m; sourceTree = "<group>"; };
7DF8424F1F4058C600D42D79 /* TweakPreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TweakPreferencesController.h; sourceTree = "<group>"; };
7DF842501F4058C600D42D79 /* TweakPreferencesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TweakPreferencesController.m; sourceTree = "<group>"; };
@ -59,8 +52,8 @@
7DF842581F4058DD00D42D79 /* NSBundle+WeChatTweak.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSBundle+WeChatTweak.m"; sourceTree = "<group>"; };
7DF8425F1F40590500D42D79 /* WeChatTweakHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeChatTweakHeaders.h; sourceTree = "<group>"; };
7DF842641F40594400D42D79 /* Prefs-Tweak.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "Prefs-Tweak.tiff"; sourceTree = "<group>"; };
A82E6F61C63DBD47219BB308 /* Pods-WeChatTweak.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WeChatTweak.debug.xcconfig"; path = "Pods/Target Support Files/Pods-WeChatTweak/Pods-WeChatTweak.debug.xcconfig"; sourceTree = "<group>"; };
B418F83DA5D4A992F73514A9 /* Pods-WeChatTweak.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WeChatTweak.release.xcconfig"; path = "Pods/Target Support Files/Pods-WeChatTweak/Pods-WeChatTweak.release.xcconfig"; sourceTree = "<group>"; };
BAF38C6487242E521519F1D6 /* Pods-WeChatTweak.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WeChatTweak.release.xcconfig"; path = "Target Support Files/Pods-WeChatTweak/Pods-WeChatTweak.release.xcconfig"; sourceTree = "<group>"; };
C7011C4A6B32C90FC15D183A /* Pods-WeChatTweak.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WeChatTweak.debug.xcconfig"; path = "Target Support Files/Pods-WeChatTweak/Pods-WeChatTweak.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -68,21 +61,30 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D84599A16A2504BCF95DB436 /* libPods-WeChatTweak.a in Frameworks */,
8F57F4CE7792FAE70DE20B02 /* libPods-WeChatTweak.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
785C3947774E235ED4EB5A14 /* Frameworks */ = {
40D8B49D8195C4EF553380D3 /* Frameworks */ = {
isa = PBXGroup;
children = (
153504EC5C9196C0D85213CF /* libPods-WeChatTweak.a */,
015D5D0AC81B469FA2FF78F2 /* libPods-WeChatTweak.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
43C5C16B78FD88F555215AC8 /* Pods */ = {
isa = PBXGroup;
children = (
C7011C4A6B32C90FC15D183A /* Pods-WeChatTweak.debug.xcconfig */,
BAF38C6487242E521519F1D6 /* Pods-WeChatTweak.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
7D5AAF3520DF4B9700860EEE /* Controller */ = {
isa = PBXGroup;
children = (
@ -102,20 +104,10 @@
path = Category;
sourceTree = "<group>";
};
7D5AAF3720DF4BB300860EEE /* Vendor */ = {
isa = PBXGroup;
children = (
7D9049F41F82A415004E6370 /* fishhook.h */,
7D9049F31F82A415004E6370 /* fishhook.c */,
);
path = Vendor;
sourceTree = "<group>";
};
7D5AAF3820DF4BC400860EEE /* Supporting Files */ = {
isa = PBXGroup;
children = (
7DF8425F1F40590500D42D79 /* WeChatTweakHeaders.h */,
7DF8422B1F40583F00D42D79 /* Info.plist */,
7D54A06C20E74FE500CB5306 /* Localizable.strings */,
);
path = "Supporting Files";
@ -126,8 +118,8 @@
children = (
7DF842291F40583F00D42D79 /* WeChatTweak */,
7DF842281F40583F00D42D79 /* Products */,
FEFA9C3F34481028661EEC5A /* Pods */,
785C3947774E235ED4EB5A14 /* Frameworks */,
43C5C16B78FD88F555215AC8 /* Pods */,
40D8B49D8195C4EF553380D3 /* Frameworks */,
);
sourceTree = "<group>";
};
@ -149,10 +141,8 @@
7D64150D27A94BEA00A8A398 /* MultipleInstances.m */,
7D64150F27A94DE200A8A398 /* PreferencesWindow.m */,
7D64150627A9469900A8A398 /* ContextMenu.m */,
7D64150927A9481C00A8A398 /* ContactData.m */,
7D14E5A21F6447DB00D75132 /* Alfred.h */,
7D14E5A31F6447DB00D75132 /* Alfred.m */,
7D5AAF3720DF4BB300860EEE /* Vendor */,
7D5AAF3620DF4BA400860EEE /* Category */,
7D5AAF3520DF4B9700860EEE /* Controller */,
7DF842631F40594400D42D79 /* Resources */,
@ -169,15 +159,6 @@
path = Resources;
sourceTree = "<group>";
};
FEFA9C3F34481028661EEC5A /* Pods */ = {
isa = PBXGroup;
children = (
A82E6F61C63DBD47219BB308 /* Pods-WeChatTweak.debug.xcconfig */,
B418F83DA5D4A992F73514A9 /* Pods-WeChatTweak.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@ -187,7 +168,6 @@
files = (
7DF8422C1F40583F00D42D79 /* WeChatTweak.h in Headers */,
7DF8425B1F4058DD00D42D79 /* NSBundle+WeChatTweak.h in Headers */,
7D9049F61F82A41A004E6370 /* fishhook.h in Headers */,
7D14E5A41F6447DB00D75132 /* Alfred.h in Headers */,
7DF842601F40590500D42D79 /* WeChatTweakHeaders.h in Headers */,
7DF842521F4058C600D42D79 /* TweakPreferencesController.h in Headers */,
@ -201,7 +181,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 7DF8422F1F40583F00D42D79 /* Build configuration list for PBXNativeTarget "WeChatTweak" */;
buildPhases = (
CB198514792C1F69F3B65026 /* [CP] Check Pods Manifest.lock */,
6B4980DF8819FCBBE96201D3 /* [CP] Check Pods Manifest.lock */,
7DF842221F40583F00D42D79 /* Sources */,
7DF842231F40583F00D42D79 /* Frameworks */,
7DF842241F40583F00D42D79 /* Headers */,
@ -223,8 +203,8 @@
7DF8421E1F40583F00D42D79 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0940;
ORGANIZATIONNAME = Sunnyyoung;
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1540;
TargetAttributes = {
7DF842261F40583F00D42D79 = {
CreatedOnToolsVersion = 8.3.3;
@ -233,7 +213,7 @@
};
};
buildConfigurationList = 7DF842211F40583F00D42D79 /* Build configuration list for PBXProject "WeChatTweak" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
@ -266,8 +246,31 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
6B4980DF8819FCBBE96201D3 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-WeChatTweak-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
7DE5D07F218319DF00ABCE56 /* Export Framework */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@ -284,24 +287,6 @@
shellPath = /bin/sh;
shellScript = "FRAMEWORK=\"${TARGET_NAME}.framework\"\nln -sf \"${BUILT_PRODUCTS_DIR}/${FRAMEWORK}\" \"${SRCROOT}\"\n";
};
CB198514792C1F69F3B65026 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-WeChatTweak-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@ -314,8 +299,6 @@
7D64150827A9469900A8A398 /* ContextMenu.m in Sources */,
7D2194CC264701950068F4CC /* AntiRevoke.m in Sources */,
7DF842341F4058AB00D42D79 /* WeChatTweak.m in Sources */,
7D64150A27A9481C00A8A398 /* ContactData.m in Sources */,
7D9049F51F82A41A004E6370 /* fishhook.c in Sources */,
7D64151027A94DE200A8A398 /* PreferencesWindow.m in Sources */,
7D64150E27A94BEA00A8A398 /* MultipleInstances.m in Sources */,
7DF8425C1F4058DD00D42D79 /* NSBundle+WeChatTweak.m in Sources */,
@ -330,9 +313,9 @@
isa = PBXVariantGroup;
children = (
7D54A05F20E74E4600CB5306 /* Base */,
7D64B96727853C2100A07164 /* en */,
7D64B96827853C2800A07164 /* zh-Hans */,
7D64B96927853C2B00A07164 /* zh-Hant */,
7DAE1DD727E828960009C01E /* en */,
7DAE1DD927E828A50009C01E /* zh-Hans */,
7DAE1DDB27E828B00009C01E /* zh-Hant */,
);
name = TweakPreferencesController.xib;
sourceTree = "<group>";
@ -357,7 +340,7 @@
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@ -376,6 +359,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@ -383,8 +367,8 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 12;
DEBUG_INFORMATION_FORMAT = dwarf;
CURRENT_PROJECT_VERSION = 25;
DEAD_CODE_STRIPPING = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
@ -401,8 +385,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MARKETING_VERSION = 1.2.1;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.5.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
@ -417,7 +401,7 @@
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
@ -436,6 +420,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@ -443,8 +428,8 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 12;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
CURRENT_PROJECT_VERSION = 25;
DEAD_CODE_STRIPPING = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
@ -455,8 +440,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MARKETING_VERSION = 1.2.1;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 1.5.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
VERSIONING_SYSTEM = "apple-generic";
@ -465,20 +450,23 @@
};
7DF842301F40583F00D42D79 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = A82E6F61C63DBD47219BB308 /* Pods-WeChatTweak.debug.xcconfig */;
baseConfigurationReference = C7011C4A6B32C90FC15D183A /* Pods-WeChatTweak.debug.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "";
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 15;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 9;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = "WeChatTweak/Supporting Files/Info.plist";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2017年 Sunny Young. All rights reserved.";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.2.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = app.tweaks.WeChatTweak;
PRODUCT_NAME = "$(TARGET_NAME)";
};
@ -486,20 +474,23 @@
};
7DF842311F40583F00D42D79 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = B418F83DA5D4A992F73514A9 /* Pods-WeChatTweak.release.xcconfig */;
baseConfigurationReference = BAF38C6487242E521519F1D6 /* Pods-WeChatTweak.release.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "";
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 15;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 9;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = "WeChatTweak/Supporting Files/Info.plist";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2017年 Sunny Young. All rights reserved.";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 1.2.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = app.tweaks.WeChatTweak;
PRODUCT_NAME = "$(TARGET_NAME)";
};

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1120"
LastUpgradeVersion = "1540"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -6,7 +6,7 @@
// Copyright © 2017年 Sunnyyoung. All rights reserved.
//
#import <YYModel/YYModel.h>
#import <objc/runtime.h>
#import <GCDWebServer/GCDWebServer.h>
#import <GCDWebServer/GCDWebServerDataResponse.h>

View File

@ -17,8 +17,6 @@
@implementation AlfredManager
static int port = 48065;
+ (void)load {
[AlfredManager.sharedInstance startListener];
}
@ -37,17 +35,19 @@ static int port = 48065;
return;
}
self.server = [[GCDWebServer alloc] init];
// Search contancts
// Search contacts
[self.server addHandlerForMethod:@"GET" path:@"/wechat/search" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse * _Nullable(__kindof GCDWebServerRequest * _Nonnull request) {
NSString *path = ({
NSString *path = nil;
if ([objc_getClass("PathUtility") respondsToSelector:@selector(GetCurUserDocumentPath)]) {
path = [objc_getClass("PathUtility") GetCurUserDocumentPath];
} else {
path = nil;
}
path;
});
NSString *keyword = [request.query[@"keyword"] lowercaseString] ? : @"";
NSString *hostname = request.headers[@"Host"];
NSString *url1 = [NSString stringWithFormat:@"127.0.0.1:%d", port];
NSString *url2 = [NSString stringWithFormat:@"localhost:%d", port];
if(!([hostname isEqualToString:url1] | [hostname isEqualToString:url2])){
return [GCDWebServerResponse responseWithStatusCode:404];
}
NSArray<WCContactData *> *contacts = ({
MMServiceCenter *serviceCenter = [objc_getClass("MMServiceCenter") defaultCenter];
ContactStorage *contactStorage = [serviceCenter getService:objc_getClass("ContactStorage")];
@ -57,9 +57,10 @@ static int port = 48065;
[array addObjectsFromArray:[groupStorage GetGroupContactList:2 ContactType:0]];
array;
});
NSArray<WCContactData *> *results = ({
NSMutableArray<WCContactData *> *results = [NSMutableArray array];
NSArray<NSDictionary<NSString *, id> *> *items = ({
NSMutableArray<NSDictionary<NSString *, id> *> *items = NSMutableArray.array;
for (WCContactData *contact in contacts) {
NSString *avatar = [NSString stringWithFormat:@"%@/Avatar/%@.jpg", path, [contact.m_nsUsrName md5String]];
BOOL isOfficialAccount = (contact.m_uiCertificationFlag >> 0x3 & 0x1) == 1;
BOOL containsNickName = [contact.m_nsNickName.lowercaseString containsString:keyword];
BOOL containsUsername = [contact.m_nsUsrName.lowercaseString containsString:keyword];
@ -69,23 +70,33 @@ static int port = 48065;
BOOL containsRemarkPinyin = [contact.m_nsRemarkPYFull.lowercaseString containsString:keyword];
BOOL matchRemarkShortPinyin = [contact.m_nsRemarkPYShort.lowercaseString isEqualToString:keyword];
if (!isOfficialAccount && (containsNickName || containsUsername || containsAliasName || containsRemark || containsNickNamePinyin || containsRemarkPinyin || matchRemarkShortPinyin)) {
[results addObject:contact];
[items addObject:@{
@"icon": @{
@"path": [NSFileManager.defaultManager fileExistsAtPath:avatar] ? avatar : NSNull.null
},
@"title": ({
id value = nil;
if (contact.m_nsRemark.length) {
value = contact.m_nsRemark;
} else if (contact.m_nsNickName.length) {
value = contact.m_nsNickName;
} else {
value = NSNull.null;
}
value;
}),
@"subtitle": contact.m_nsNickName.length ? contact.m_nsNickName : NSNull.null,
@"arg": contact.m_nsUsrName.length ? contact.m_nsUsrName : NSNull.null,
@"valid": @(contact.m_nsUsrName.length > 0)
}];
}
}
results;
items;
});
return [GCDWebServerDataResponse responseWithJSONObject:[results yy_modelToJSONObject]];
return [GCDWebServerDataResponse responseWithJSONObject:@{@"items": items}];
}];
// Start chat
// Start session
[self.server addHandlerForMethod:@"GET" path:@"/wechat/start" requestClass:[GCDWebServerRequest class] processBlock:^GCDWebServerResponse * _Nullable(__kindof GCDWebServerRequest * _Nonnull request) {
NSString *hostname = request.headers[@"Host"];
NSString *url1 = [NSString stringWithFormat:@"127.0.0.1:%d", port];
NSString *url2 = [NSString stringWithFormat:@"localhost:%d", port];
if(!([hostname isEqualToString:url1] | [hostname isEqualToString:url2])){
return [GCDWebServerResponse responseWithStatusCode:404];
}
WCContactData *contact = ({
NSString *session = request.query[@"session"];
WCContactData *contact = nil;
@ -108,8 +119,10 @@ static int port = 48065;
});
return [GCDWebServerResponse responseWithStatusCode:200];
}];
[self.server startWithOptions:@{GCDWebServerOption_Port: [NSNumber numberWithInt:port],
GCDWebServerOption_BindToLocalhost: @(YES)} error:nil];
[self.server startWithOptions:@{
GCDWebServerOption_Port: @(48065),
GCDWebServerOption_BindToLocalhost: @(YES)
} error:nil];
}
- (void)stopListener {

View File

@ -12,168 +12,56 @@
@implementation NSObject (AntiRevoke)
static void __attribute__((constructor)) tweak(void) {
[objc_getClass("FFProcessReqsvrZZ") jr_swizzleMethod:NSSelectorFromString(@"FFToNameFavChatZZ:sessionMsgList:") withMethod:@selector(tweak_FFToNameFavChatZZ:sessionMsgList:) error:nil];
[objc_getClass("FFProcessReqsvrZZ") jr_swizzleMethod:NSSelectorFromString(@"DelRevokedMsg:msgData:") withMethod:@selector(tweak_DelRevokedMsg:msgData:) error:nil];
[objc_getClass("FFProcessReqsvrZZ") jr_swizzleMethod:NSSelectorFromString(@"notifyAddRevokePromptMsgOnMainThread:msgData:") withMethod:@selector(tweak_notifyAddRevokePromptMsgOnMainThread:msgData:) error:nil];
[objc_getClass("MMMessageCellView") jr_swizzleMethod:NSSelectorFromString(@"initWithFrame:") withMethod:@selector(tweak_initWithFrame:) error:nil];
[objc_getClass("MMMessageCellView") jr_swizzleMethod:NSSelectorFromString(@"populateWithMessage:") withMethod:@selector(tweak_populateWithMessage:) error:nil];
[objc_getClass("MMMessageCellView") jr_swizzleMethod:NSSelectorFromString(@"layout") withMethod:@selector(tweak_layout) error:nil];
}
- (void)tweak_FFToNameFavChatZZ:(MessageData *)message sessionMsgList:(nullable id)sessionMsgList {
// - (id)GetMsgData:(id)arg1 svrId:(unsigned long long)arg2;
SEL GetMsgDataSelector = NSSelectorFromString(@"GetMsgData:svrId:");
if (![self respondsToSelector:GetMsgDataSelector]) {
// Fallback to origin method
return [self tweak_FFToNameFavChatZZ:message sessionMsgList:sessionMsgList];
}
// Decode message
NSDictionary *dictionary = [NSDictionary dictionaryWithXMLString:message.msgContent];
NSString *session = dictionary[@"revokemsg"][@"session"];
NSString *newMessageID = dictionary[@"revokemsg"][@"newmsgid"];
NSString *replaceMessage = dictionary[@"revokemsg"][@"replacemsg"];
// Get message data
MessageData *messageData = ((id (*)(id, SEL, id, unsigned long long))objc_msgSend)(self, GetMsgDataSelector, session, newMessageID.longLongValue);
- (void)tweak_DelRevokedMsg:(NSString *)session msgData:(MessageData *)messageData {
if (messageData.isSendFromSelf) {
// Fallback to origin method
[self tweak_FFToNameFavChatZZ:message sessionMsgList:sessionMsgList];
[self tweak_DelRevokedMsg:session msgData:messageData];
} else {
switch (WeChatTweak.revokedMessageStyle) {
case WTRevokedMessageStyleClassic:
[self handleRevokedMessageIntoClassicStyleWithSession:session messageData:messageData replaceMessage:replaceMessage];
break;
case WTRevokedMessageStyleMask:
[self handleRevokedMessageIntoMaskStyleWithSession:session messageData:messageData replaceMessage:replaceMessage];
break;
default:
break;
}
}
}
- (void)handleRevokedMessageIntoClassicStyleWithSession:(NSString *)session messageData:(MessageData *)messageData replaceMessage:(NSString *)replaceMessage {
// Prepare message data
MessageData *localMessageData = messageData;
MessageData *promptMessageData = ({
MessageData *data = [[objc_getClass("MessageData") alloc] initWithMsgType:10000];
data.msgStatus = 4;
data.toUsrName = localMessageData.toUsrName;
data.fromUsrName = localMessageData.fromUsrName;
data.mesSvrID = localMessageData.mesSvrID;
data.mesLocalID = localMessageData.mesLocalID;
data.msgCreateTime = localMessageData.msgCreateTime;
data.msgContent = ({
NSString *fromUserName = [replaceMessage componentsSeparatedByString:@" "].firstObject;
NSString *userRevoke = [NSString stringWithFormat:@"%@ %@ ", fromUserName, [NSBundle.tweakBundle localizedStringForKey:@"Tweak.Message.Recalled"]];
NSString *tips = [NSString stringWithFormat:[NSBundle.tweakBundle localizedStringForKey:@"Tweak.Message.InterceptedARecalledMessage"], userRevoke];
NSMutableString *msgContent = [NSMutableString stringWithString:tips];
switch (localMessageData.messageType) {
case MessageDataTypeText: {
if (localMessageData.msgContent.length) {
if ([session rangeOfString:@"@chatroom"].location == NSNotFound) {
[msgContent appendFormat:@"\"%@\"", localMessageData.msgContent];
} else {
[msgContent appendFormat:@"\"%@\"", [localMessageData.msgContent componentsSeparatedByString:@":\n"].lastObject];
}
} else {
[msgContent appendString:[NSBundle.tweakBundle localizedStringForKey:@"Tweak.Message.AMessage"]];
}
break;
}
case MessageDataTypeImage:
[msgContent appendFormat:@"<%@>", [NSBundle.tweakBundle localizedStringForKey:@"Tweak.Message.Image"]]; break;
case MessageDataTypeVoice:
[msgContent appendFormat:@"<%@>", [NSBundle.tweakBundle localizedStringForKey:@"Tweak.Message.Voice"]]; break;
case MessageDataTypeVideo:
[msgContent appendFormat:@"<%@>", [NSBundle.tweakBundle localizedStringForKey:@"Tweak.Message.Video"]]; break;
case MessageDataTypeSticker:
[msgContent appendFormat:@"<%@>", [NSBundle.tweakBundle localizedStringForKey:@"Tweak.Message.Sticker"]]; break;
case MessageDataTypeAppUrl:
[msgContent appendFormat:@"<%@>", [NSBundle.tweakBundle localizedStringForKey:@"Tweak.Message.Link"]]; break;
default:
[msgContent appendString:[NSBundle.tweakBundle localizedStringForKey:@"Tweak.Message.AMessage"]]; break;
}
msgContent.copy;
messageData.mesSvrID = messageData.mesLocalID;
[((FFProcessReqsvrZZ *)self) ModifyMsgData:session msgData:messageData];
dispatch_async(dispatch_get_main_queue(), ^{
[((FFProcessReqsvrZZ *)self) notifyDelMsgOnMainThread:session msgData:messageData isRevoke:YES];
[((FFProcessReqsvrZZ *)self) notifyAddMsgOnMainThread:session msgData:messageData];
});
data;
});
// Prepare notification information
MMServiceCenter *serviceCenter = [objc_getClass("MMServiceCenter") defaultCenter];
NSUserNotification *userNotification = [[NSUserNotification alloc] init];
BOOL isChatStatusNotifyOpen = YES;
if ([session rangeOfString:@"@chatroom"].location == NSNotFound) {
ContactStorage *contactStorage = [serviceCenter getService:objc_getClass("ContactStorage")];
WCContactData *contact = [contactStorage GetContact:session];
isChatStatusNotifyOpen = [contact isChatStatusNotifyOpen];
userNotification.informativeText = replaceMessage;
} else {
GroupStorage *groupStorage = [serviceCenter getService:objc_getClass("GroupStorage")];
WCContactData *groupContact = [groupStorage GetGroupContact:session];
isChatStatusNotifyOpen = [groupContact isChatStatusNotifyOpen];
NSString *groupName = groupContact.m_nsNickName.length ? groupContact.m_nsNickName : [NSBundle.tweakBundle localizedStringForKey:@"Tweak.Title.Group"];
userNotification.informativeText = [NSString stringWithFormat:@"%@: %@", groupName, replaceMessage];
}
// - (void)AddLocalMsg:(id)arg1 msgData:(id)arg2;
SEL addMsgSelector = NSSelectorFromString(@"AddLocalMsg:msgData:");
if ([self respondsToSelector:addMsgSelector]) {
((void (*)(id, SEL, id, id))objc_msgSend)(self, addMsgSelector, session, promptMessageData);
}
// Dispatch notification
dispatch_async(dispatch_get_main_queue(), ^{
// Deliver notification
RevokeNotificationType notificationType = [[NSUserDefaults standardUserDefaults] integerForKey:WeChatTweakPreferenceRevokeNotificationTypeKey];
if (notificationType == RevokeNotificationTypeReceiveAll || (notificationType == RevokeNotificationTypeFollow && isChatStatusNotifyOpen)) {
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:userNotification];
}
});
}
- (void)handleRevokedMessageIntoMaskStyleWithSession:(NSString *)session messageData:(MessageData *)messageData replaceMessage:(NSString *)replaceMessage {
MMRevokeMsgService *service = [[objc_getClass("MMServiceCenter") defaultCenter] getService:objc_getClass("MMRevokeMsgService")];
[service.db insertRevokeMsg:({
RevokeMsgItem *item = [[objc_getClass("RevokeMsgItem") alloc] init];
item.svrId = @(messageData.mesSvrID).stringValue;
item.createTime = UINT32_MAX;
item;
})];
WeChat *wechat = [objc_getClass("WeChat") sharedInstance];
if ([wechat respondsToSelector:NSSelectorFromString(@"chatsViewController")]) {
id chatsViewController = [wechat valueForKey:@"chatsViewController"];
if ([chatsViewController respondsToSelector:NSSelectorFromString(@"chatDetailSplitViewController")]) {
id chatDetailSplitViewController = [chatsViewController valueForKey:@"chatDetailSplitViewController"];
if ([chatDetailSplitViewController respondsToSelector:NSSelectorFromString(@"chatMessageViewController")]) {
id chatMessageViewController = [chatDetailSplitViewController valueForKey:@"chatMessageViewController"];
if ([chatMessageViewController respondsToSelector:NSSelectorFromString(@"reloadTableView")]) {
dispatch_async(dispatch_get_main_queue(), ^{
((void (*)(id, SEL))objc_msgSend)(chatMessageViewController, NSSelectorFromString(@"reloadTableView"));
});
}
}
}
}
// Prepare notification information
MMServiceCenter *serviceCenter = [objc_getClass("MMServiceCenter") defaultCenter];
NSUserNotification *userNotification = [[NSUserNotification alloc] init];
BOOL isChatStatusNotifyOpen = YES;
if ([session rangeOfString:@"@chatroom"].location == NSNotFound) {
ContactStorage *contactStorage = [serviceCenter getService:objc_getClass("ContactStorage")];
WCContactData *contact = [contactStorage GetContact:session];
isChatStatusNotifyOpen = [contact isChatStatusNotifyOpen];
userNotification.informativeText = replaceMessage;
- (void)tweak_notifyAddRevokePromptMsgOnMainThread:(NSString *)session msgData:(MessageData *)messageData {
MessageData *localMessage = [((FFProcessReqsvrZZ *)self) GetMsgData:session localId:messageData.mesLocalID];
if (!localMessage || localMessage.mesSvrID != messageData.mesLocalID) {
[self tweak_notifyAddRevokePromptMsgOnMainThread:session msgData:messageData];
} else {
GroupStorage *groupStorage = [serviceCenter getService:objc_getClass("GroupStorage")];
WCContactData *groupContact = [groupStorage GetGroupContact:session];
isChatStatusNotifyOpen = [groupContact isChatStatusNotifyOpen];
NSString *groupName = groupContact.m_nsNickName.length ? groupContact.m_nsNickName : [NSBundle.tweakBundle localizedStringForKey:@"Tweak.Title.Group"];
userNotification.informativeText = [NSString stringWithFormat:@"%@: %@", groupName, replaceMessage];
}
// Dispatch notification
dispatch_async(dispatch_get_main_queue(), ^{
// Deliver notification
RevokeNotificationType notificationType = [[NSUserDefaults standardUserDefaults] integerForKey:WeChatTweakPreferenceRevokeNotificationTypeKey];
if (notificationType == RevokeNotificationTypeReceiveAll || (notificationType == RevokeNotificationTypeFollow && isChatStatusNotifyOpen)) {
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:userNotification];
MMServiceCenter *serviceCenter = [objc_getClass("MMServiceCenter") defaultCenter];
NSUserNotification *userNotification = [[NSUserNotification alloc] init];
BOOL isChatStatusNotifyOpen = YES;
if ([session rangeOfString:@"@chatroom"].location == NSNotFound) {
ContactStorage *contactStorage = [serviceCenter getService:objc_getClass("ContactStorage")];
WCContactData *contact = [contactStorage GetContact:session];
isChatStatusNotifyOpen = [contact isChatStatusNotifyOpen];
userNotification.informativeText = messageData.msgContent;
} else {
GroupStorage *groupStorage = [serviceCenter getService:objc_getClass("GroupStorage")];
WCContactData *groupContact = [groupStorage GetGroupContact:session];
isChatStatusNotifyOpen = [groupContact isChatStatusNotifyOpen];
NSString *groupName = groupContact.m_nsNickName.length ? groupContact.m_nsNickName : [NSBundle.tweakBundle localizedStringForKey:@"Tweak.Title.Group"];
userNotification.informativeText = [NSString stringWithFormat:@"%@: %@", groupName, messageData.msgContent];
}
});
// Dispatch notification
dispatch_async(dispatch_get_main_queue(), ^{
// Deliver notification
WeChatTweakNotificationType notificationType = WeChatTweak.notificationType;
if (notificationType == WeChatTweakNotificationTypeReceiveAll || (notificationType == WeChatTweakNotificationTypeInherited && isChatStatusNotifyOpen)) {
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:userNotification];
}
});
}
}
- (instancetype)tweak_initWithFrame:(NSRect)arg1 {
@ -187,7 +75,7 @@ static void __attribute__((constructor)) tweak(void) {
revokeTextField.usesSingleLineMode = YES;
revokeTextField.tag = 9527;
revokeTextField.stringValue = [NSBundle.tweakBundle localizedStringForKey:@"Tweak.Message.RecalledMark"];
revokeTextField.font = [NSFont systemFontOfSize:10];
revokeTextField.font = [NSFont systemFontOfSize:7.0];
revokeTextField.textColor = [NSColor lightGrayColor];
[revokeTextField sizeToFit];
[view addSubview:revokeTextField];
@ -196,8 +84,7 @@ static void __attribute__((constructor)) tweak(void) {
- (void)tweak_populateWithMessage:(MMMessageTableItem *)tableItem {
[self tweak_populateWithMessage:tableItem];
MMRevokeMsgService *service = [[objc_getClass("MMServiceCenter") defaultCenter] getService:objc_getClass("MMRevokeMsgService")];
BOOL recalled = tableItem.message ? (tableItem.message.messageType != MessageDataTypePrompt && [service.db getRevokeMsg:@(tableItem.message.mesSvrID).stringValue] != NULL) : NO;
BOOL recalled = tableItem.message.mesSvrID && tableItem.message.mesSvrID == tableItem.message.mesLocalID;
[((MMMessageCellView *)self).subviews enumerateObjectsUsingBlock:^(__kindof NSView * _Nonnull view, NSUInteger index, BOOL * _Nonnull stop) {
if (view.tag != 9527) {
return ;
@ -205,7 +92,7 @@ static void __attribute__((constructor)) tweak(void) {
*stop = YES;
view.hidden = !recalled;
}];
((MMMessageCellView *)self).layer.backgroundColor = recalled ? [NSColor.systemYellowColor colorWithAlphaComponent:0.3].CGColor : nil;
((MMMessageCellView *)self).layer.backgroundColor = recalled ? WeChatTweak.maskColor.CGColor : nil;
}
- (void)tweak_layout {

View File

@ -1,48 +0,0 @@
//
// ContactData.m
// WeChatTweak
//
// Created by Sunny Young on 2022/2/1.
// Copyright © 2022 Sunnyyoung. All rights reserved.
//
#import "WeChatTweak.h"
@implementation NSObject (ContactData)
static void __attribute__((constructor)) tweak(void) {
objc_property_attribute_t type = { "T", "@\"NSString\"" }; // NSString
objc_property_attribute_t atom = { "N", "" }; // nonatomic
objc_property_attribute_t ownership = { "&", "" }; // C = copy & = strong
objc_property_attribute_t backingivar = { "V", "_m_nsHeadImgUrl" }; // ivar name
objc_property_attribute_t attrs[] = { type, atom, ownership, backingivar };
class_addProperty(objc_getClass("WCContactData"), "wt_avatarPath", attrs, 4);
class_addMethod(objc_getClass("WCContactData"), @selector(wt_avatarPath), method_getImplementation(class_getInstanceMethod(objc_getClass("WCContactData"), @selector(wt_avatarPath))), "@@:");
class_addMethod(objc_getClass("WCContactData"), @selector(setWt_avatarPath:), method_getImplementation(class_getInstanceMethod(objc_getClass("WCContactData"), @selector(setWt_avatarPath:))), "v@:@");
class_addMethod(objc_getClass("WCContactData"), @selector(modelPropertyWhitelist), method_getImplementation(class_getClassMethod(objc_getClass("WCContactData"), @selector(modelPropertyWhitelist))), "v@:");
}
- (NSString *)wt_avatarPath {
if (![objc_getClass("PathUtility") respondsToSelector:@selector(GetCurUserDocumentPath)]) {
return @"";
}
NSString *pathString = [NSString stringWithFormat:@"%@/Avatar/%@.jpg", [objc_getClass("PathUtility") GetCurUserDocumentPath], [((WCContactData *)self).m_nsUsrName md5String]];
return [NSFileManager.defaultManager fileExistsAtPath:pathString] ? pathString : @"";
}
- (void)setWt_avatarPath:(NSString *)avatarPath {
// For readonly
return;
}
+ (NSArray *)modelPropertyWhitelist {
NSArray *list =@[
@"wt_avatarPath",
@"m_nsRemark",
@"m_nsNickName",
@"m_nsUsrName"
];
return WeChatTweak.compressedJSONEnabled ? list : nil;
}
@end

View File

@ -11,6 +11,11 @@
#import <CoreImage/CoreImage.h>
typedef NS_ENUM(NSUInteger, OpenMapMenuType) {
OpenMapMenuTypeGoogleMaps = 0,
OpenMapMenuTypeAmap
};
@implementation NSObject (ContextMenu)
static void __attribute__((constructor)) tweak(void) {
@ -76,6 +81,26 @@ static void __attribute__((constructor)) tweak(void) {
})];
break;
}
case MessageDataTypeLocation: {
[menu addItem:NSMenuItem.separatorItem];
[menu addItem:({
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSBundle.tweakBundle localizedStringForKey:@"Tweak.MessageMenuItem.OpenInGoogleMaps"]
action:@selector(tweakOpenMaps:)
keyEquivalent:@""];
item.target = self;
item.tag = OpenMapMenuTypeGoogleMaps;
item;
})];
[menu addItem:({
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSBundle.tweakBundle localizedStringForKey:@"Tweak.MessageMenuItem.OpenInAmap"]
action:@selector(tweakOpenMaps:)
keyEquivalent:@""];
item.target = self;
item.tag = OpenMapMenuTypeAmap;
item;
})];
break;
}
default: {
break;
}
@ -153,4 +178,32 @@ static void __attribute__((constructor)) tweak(void) {
}];
}
- (void)tweakOpenMaps:(NSMenuItem *)sender {
MMMessageCellView *cell = (MMMessageCellView *)sender.target;
NSURL *url = ({
NSURL *url = nil;
NSDictionary *location = [NSDictionary dictionaryWithXMLString:cell.messageTableItem.message.msgContent][@"location"];
id x = location[@"_x"];
id y = location[@"_y"];
if (x && y) {
switch (sender.tag) {
case OpenMapMenuTypeGoogleMaps:
url = [NSURL URLWithString:[NSString stringWithFormat:@"https://www.google.com/maps/search/?api=1&query=%@,%@", x, y]];
break;
case OpenMapMenuTypeAmap:
url = [NSURL URLWithString:[NSString stringWithFormat:@"https://uri.amap.com/marker?position=%@,%@", y, x]];
break;
default:
break;
}
}
url;
});
if (url) {
[NSWorkspace.sharedWorkspace openURL:url];
}
}
@end

View File

@ -1,153 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19529" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19529"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="TweakPreferencesController">
<connections>
<outlet property="compressedJSONEnabledButton" destination="ylY-lF-oFq" id="yqW-Bl-hNf"/>
<outlet property="maskColorWell" destination="os7-vb-CNH" id="dYW-6g-0zh"/>
<outlet property="notificationTypeButton" destination="6x2-KV-p8w" id="Kfn-2a-Yup"/>
<outlet property="revokedMessageStyleButton" destination="eqS-1n-9dO" id="QVg-Sy-CoY"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="431" height="122"/>
<rect key="frame" x="0.0" y="0.0" width="316" height="88"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="B87-eD-uhI">
<rect key="frame" x="10" y="86" width="186" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Message recalled notification:" usesSingleLineMode="YES" id="UKv-CM-nGt">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="6x2-KV-p8w">
<rect key="frame" x="199" y="80" width="93" height="25"/>
<popUpButtonCell key="cell" type="push" title="Inherited" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="axesIndependently" inset="2" selectedItem="gec-CY-E1x" id="wek-GT-N5V">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="H2J-gJ-aGD">
<items>
<menuItem title="Inherited" state="on" id="gec-CY-E1x">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="All" id="da4-aJ-lEy">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Disabled" id="Uk9-Oc-Jtv">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</popUpButtonCell>
<connections>
<action selector="switchNotificationTypeAction:" target="-2" id="xjO-Ck-wem"/>
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zsd-Bb-6l4">
<rect key="frame" x="32" y="54" width="164" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Alfred JSON compressing:" usesSingleLineMode="YES" id="jHw-2a-B2t">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7wK-v5-BgQ">
<rect key="frame" x="46" y="22" width="150" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Revoked message style:" usesSingleLineMode="YES" id="mPT-nA-idf">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ylY-lF-oFq">
<rect key="frame" x="199" y="48" width="92" height="25"/>
<popUpButtonCell key="cell" type="push" title="Disabled" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="axesIndependently" inset="2" selectedItem="MEN-Kg-wfj" id="taL-8q-Quu">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="2qr-A3-Yo5">
<items>
<menuItem title="Enabled" id="10G-t9-s4T">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Disabled" state="on" id="MEN-Kg-wfj">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</popUpButtonCell>
<connections>
<action selector="switchCompressedJSONEnabledAction:" target="-2" id="HLt-oc-7An"/>
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kNm-y0-HmG">
<rect key="frame" x="295" y="54" width="96" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" title="Need to restart" usesSingleLineMode="YES" id="2vl-mc-m3L">
<font key="font" metaFont="system"/>
<color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eqS-1n-9dO">
<rect key="frame" x="199" y="16" width="83" height="25"/>
<popUpButtonCell key="cell" type="push" title="Classic" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="axesIndependently" inset="2" selectedItem="wRC-UO-k1G" id="6UY-90-fFH">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="FiI-39-AD8">
<items>
<menuItem title="Classic" state="on" id="wRC-UO-k1G">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Mask" id="gH0-wV-Bx0">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</popUpButtonCell>
<connections>
<action selector="switchRevokedMessageStyleButton:" target="-2" id="n3n-hX-s3H"/>
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ftV-1F-OnB">
<rect key="frame" x="286" y="22" width="130" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="left" title="Experimental feature" usesSingleLineMode="YES" id="lHs-du-a6F">
<font key="font" metaFont="system"/>
<color key="textColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<stackView distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xTR-Zt-kYC">
<rect key="frame" x="20" y="18" width="276" height="52"/>
<subviews>
<stackView distribution="equalCentering" orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="RwY-YV-4Af">
<rect key="frame" x="0.0" y="32" width="276" height="20"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="B87-eD-uhI">
<rect key="frame" x="-2" y="2" width="186" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Message recalled notification:" usesSingleLineMode="YES" id="UKv-CM-nGt">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="6x2-KV-p8w">
<rect key="frame" x="187" y="-4" width="93" height="25"/>
<popUpButtonCell key="cell" type="push" title="Inherited" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="axesIndependently" inset="2" selectedItem="gec-CY-E1x" id="wek-GT-N5V">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="H2J-gJ-aGD">
<items>
<menuItem title="Inherited" state="on" id="gec-CY-E1x">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="All" id="da4-aJ-lEy">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Disabled" id="Uk9-Oc-Jtv">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</popUpButtonCell>
<connections>
<action selector="switchNotificationTypeAction:" target="-2" id="xjO-Ck-wem"/>
</connections>
</popUpButton>
</subviews>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="R0D-IF-6iq">
<rect key="frame" x="0.0" y="0.0" width="228" height="24"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="2Mh-bQ-Asx">
<rect key="frame" x="-2" y="4" width="186" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" alignment="right" title="Recall mask color:" usesSingleLineMode="YES" id="3xl-c5-YvI">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<colorWell translatesAutoresizingMaskIntoConstraints="NO" id="os7-vb-CNH">
<rect key="frame" x="187" y="-2" width="44" height="28"/>
<color key="color" red="1" green="0.80000000000000004" blue="0.0" alpha="0.29833652210884354" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<action selector="changeMaskColorAction:" target="-2" id="Tfo-FJ-I64"/>
</connections>
</colorWell>
</subviews>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
</subviews>
<constraints>
<constraint firstItem="2Mh-bQ-Asx" firstAttribute="width" secondItem="B87-eD-uhI" secondAttribute="width" id="oUr-AD-5kN"/>
</constraints>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
</subviews>
<constraints>
<constraint firstItem="zsd-Bb-6l4" firstAttribute="top" secondItem="B87-eD-uhI" secondAttribute="bottom" constant="16" id="62W-9V-E2u"/>
<constraint firstItem="B87-eD-uhI" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="12" id="9tt-Vb-9e8"/>
<constraint firstItem="7wK-v5-BgQ" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="12" id="BjP-RS-ASM"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="ftV-1F-OnB" secondAttribute="trailing" constant="12" id="Bug-Cf-VNT"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="kNm-y0-HmG" secondAttribute="trailing" constant="12" id="Le8-Ns-wyj"/>
<constraint firstItem="ylY-lF-oFq" firstAttribute="leading" secondItem="zsd-Bb-6l4" secondAttribute="trailing" constant="8" id="Mat-Em-quG"/>
<constraint firstItem="eqS-1n-9dO" firstAttribute="centerY" secondItem="7wK-v5-BgQ" secondAttribute="centerY" id="Pbm-17-TcF"/>
<constraint firstItem="7wK-v5-BgQ" firstAttribute="top" secondItem="zsd-Bb-6l4" secondAttribute="bottom" constant="16" id="Ynk-No-M1P"/>
<constraint firstItem="B87-eD-uhI" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" id="acJ-lS-NeF"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="6x2-KV-p8w" secondAttribute="trailing" constant="12" id="e8z-dC-BAg"/>
<constraint firstItem="kNm-y0-HmG" firstAttribute="centerY" secondItem="ylY-lF-oFq" secondAttribute="centerY" id="eMk-RJ-Mbw"/>
<constraint firstItem="ftV-1F-OnB" firstAttribute="leading" secondItem="eqS-1n-9dO" secondAttribute="trailing" constant="10" id="g0f-zV-Ldd"/>
<constraint firstItem="eqS-1n-9dO" firstAttribute="leading" secondItem="7wK-v5-BgQ" secondAttribute="trailing" constant="8" symbolic="YES" id="ghN-pe-dKr"/>
<constraint firstItem="6x2-KV-p8w" firstAttribute="centerY" secondItem="B87-eD-uhI" secondAttribute="centerY" id="gqp-om-e0O"/>
<constraint firstItem="ylY-lF-oFq" firstAttribute="centerY" secondItem="zsd-Bb-6l4" secondAttribute="centerY" id="h7g-u6-ZwV"/>
<constraint firstItem="6x2-KV-p8w" firstAttribute="leading" secondItem="B87-eD-uhI" secondAttribute="trailing" constant="8" id="i7Z-7c-5cX"/>
<constraint firstItem="zsd-Bb-6l4" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="12" id="icK-YZ-ZLo"/>
<constraint firstItem="zsd-Bb-6l4" firstAttribute="trailing" secondItem="B87-eD-uhI" secondAttribute="trailing" id="ujT-Pv-nBx"/>
<constraint firstItem="kNm-y0-HmG" firstAttribute="leading" secondItem="ylY-lF-oFq" secondAttribute="trailing" constant="10" id="urr-9v-Okd"/>
<constraint firstItem="ftV-1F-OnB" firstAttribute="centerY" secondItem="eqS-1n-9dO" secondAttribute="centerY" id="v6d-17-iac"/>
<constraint firstItem="7wK-v5-BgQ" firstAttribute="trailing" secondItem="B87-eD-uhI" secondAttribute="trailing" id="ydo-VW-YRZ"/>
<constraint firstItem="xTR-Zt-kYC" firstAttribute="centerY" secondItem="Hz6-mo-xeY" secondAttribute="centerY" id="667-ch-Pg7"/>
<constraint firstItem="xTR-Zt-kYC" firstAttribute="centerX" secondItem="Hz6-mo-xeY" secondAttribute="centerX" id="h4J-4r-fcC"/>
</constraints>
<point key="canvasLocation" x="138.5" y="179"/>
<point key="canvasLocation" x="81" y="166"/>
</customView>
</objects>
</document>

View File

@ -12,8 +12,7 @@
@interface TweakPreferencesController () <MASPreferencesViewController>
@property (weak) IBOutlet NSPopUpButton *notificationTypeButton;
@property (weak) IBOutlet NSPopUpButton *compressedJSONEnabledButton;
@property (weak) IBOutlet NSPopUpButton *revokedMessageStyleButton;
@property (weak) IBOutlet NSColorWell *maskColorWell;
@end
@ -21,6 +20,7 @@
- (void)viewDidLoad {
[super viewDidLoad];
[NSColorPanel.sharedColorPanel setShowsAlpha:YES];
}
- (void)viewWillAppear {
@ -29,27 +29,18 @@
}
- (void)reloadData {
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
RevokeNotificationType notificationType = [userDefaults integerForKey:WeChatTweakPreferenceRevokeNotificationTypeKey];
[self.notificationTypeButton selectItemAtIndex:notificationType];
[self.compressedJSONEnabledButton selectItemAtIndex:WeChatTweak.compressedJSONEnabled ? 0 : 1];
[self.revokedMessageStyleButton selectItemAtIndex:WeChatTweak.revokedMessageStyle];
self.maskColorWell.color = WeChatTweak.maskColor;
[self.notificationTypeButton selectItemAtIndex:WeChatTweak.notificationType];
}
#pragma mark - Event method
- (IBAction)switchNotificationTypeAction:(NSPopUpButton *)sender {
RevokeNotificationType type = sender.indexOfSelectedItem;
[[NSUserDefaults standardUserDefaults] setInteger:type forKey:WeChatTweakPreferenceRevokeNotificationTypeKey];
WeChatTweak.notificationType = sender.indexOfSelectedItem;
}
- (IBAction)switchCompressedJSONEnabledAction:(NSPopUpButton *)sender {
BOOL enabled = sender.indexOfSelectedItem == 0;
WeChatTweak.compressedJSONEnabled = enabled;
}
- (IBAction)switchRevokedMessageStyleButton:(NSPopUpButton *)sender {
WeChatTweak.revokedMessageStyle = sender.indexOfSelectedItem;
- (IBAction)changeMaskColorAction:(NSColorWell *)sender {
WeChatTweak.maskColor = sender.color;
}
#pragma mark - MASPreferencesViewController

View File

@ -1,42 +1,15 @@
/* Class = "NSMenuItem"; title = "Enabled"; ObjectID = "10G-t9-s4T"; */
"10G-t9-s4T.title" = "Enabled";
/* Class = "NSTextFieldCell"; title = "Need to restart"; ObjectID = "2vl-mc-m3L"; */
"2vl-mc-m3L.title" = "Need to restart";
/* Class = "NSMenuItem"; title = "Enabled"; ObjectID = "KQg-jN-y9a"; */
"KQg-jN-y9a.title" = "Enabled";
/* Class = "NSMenuItem"; title = "Disabled"; ObjectID = "MEN-Kg-wfj"; */
"MEN-Kg-wfj.title" = "Disabled";
/* Class = "NSTextFieldCell"; title = "Message recalled notification:"; ObjectID = "UKv-CM-nGt"; */
"UKv-CM-nGt.title" = "Message recalled notification:";
/* Class = "NSMenuItem"; title = "Disabled"; ObjectID = "Uk9-Oc-Jtv"; */
"Uk9-Oc-Jtv.title" = "Disabled";
/* Class = "NSMenuItem"; title = "Disabled"; ObjectID = "Vcv-eD-OM9"; */
"Vcv-eD-OM9.title" = "Disabled";
/* Class = "NSMenuItem"; title = "All"; ObjectID = "da4-aJ-lEy"; */
"da4-aJ-lEy.title" = "All";
/* Class = "NSMenuItem"; title = "Mask"; ObjectID = "gH0-wV-Bx0"; */
"gH0-wV-Bx0.title" = "Mask";
/* Class = "NSMenuItem"; title = "Inherited"; ObjectID = "gec-CY-E1x"; */
"gec-CY-E1x.title" = "Inherited";
/* Class = "NSTextFieldCell"; title = "Alfred JSON compressing:"; ObjectID = "jHw-2a-B2t"; */
"jHw-2a-B2t.title" = "Alfred JSON compressing:";
/* Class = "NSTextFieldCell"; title = "Experimental feature"; ObjectID = "lHs-du-a6F"; */
"lHs-du-a6F.title" = "Experimental feature";
/* Class = "NSTextFieldCell"; title = "Revoked message style:"; ObjectID = "mPT-nA-idf"; */
"mPT-nA-idf.title" = "Revoked message style:";
/* Class = "NSMenuItem"; title = "Classic"; ObjectID = "wRC-UO-k1G"; */
"wRC-UO-k1G.title" = "Classic";
/* Class = "NSTextFieldCell"; title = "Recall mask color:"; ObjectID = "3xl-c5-YvI"; */
"3xl-c5-YvI.title" = "Recall mask color:";

View File

@ -1,42 +1,15 @@
/* Class = "NSMenuItem"; title = "开启"; ObjectID = "10G-t9-s4T"; */
"10G-t9-s4T.title" = "开启";
/* Class = "NSTextFieldCell"; title = "需重启客户端"; ObjectID = "2vl-mc-m3L"; */
"2vl-mc-m3L.title" = "需重启客户端";
/* Class = "NSMenuItem"; title = "开启"; ObjectID = "KQg-jN-y9a"; */
"KQg-jN-y9a.title" = "开启";
/* Class = "NSMenuItem"; title = "关闭"; ObjectID = "MEN-Kg-wfj"; */
"MEN-Kg-wfj.title" = "关闭";
/* Class = "NSTextFieldCell"; title = "消息撤回通知:"; ObjectID = "UKv-CM-nGt"; */
/* Class = "NSTextFieldCell"; title = "Message recalled notification:"; ObjectID = "UKv-CM-nGt"; */
"UKv-CM-nGt.title" = "消息撤回通知:";
/* Class = "NSMenuItem"; title = "关闭"; ObjectID = "Uk9-Oc-Jtv"; */
/* Class = "NSMenuItem"; title = "Disabled"; ObjectID = "Uk9-Oc-Jtv"; */
"Uk9-Oc-Jtv.title" = "关闭";
/* Class = "NSMenuItem"; title = "关闭"; ObjectID = "Vcv-eD-OM9"; */
"Vcv-eD-OM9.title" = "关闭";
/* Class = "NSMenuItem"; title = "全部接收"; ObjectID = "da4-aJ-lEy"; */
/* Class = "NSMenuItem"; title = "All"; ObjectID = "da4-aJ-lEy"; */
"da4-aJ-lEy.title" = "全部接收";
/* Class = "NSMenuItem"; title = "遮罩"; ObjectID = "gH0-wV-Bx0"; */
"gH0-wV-Bx0.title" = "遮罩";
/* Class = "NSMenuItem"; title = "跟随聊天设置"; ObjectID = "gec-CY-E1x"; */
/* Class = "NSMenuItem"; title = "Inherited"; ObjectID = "gec-CY-E1x"; */
"gec-CY-E1x.title" = "跟随聊天设置";
/* Class = "NSTextFieldCell"; title = "Alfred JSON 压缩:"; ObjectID = "jHw-2a-B2t"; */
"jHw-2a-B2t.title" = "Alfred JSON 压缩:";
/* Class = "NSTextFieldCell"; title = "试验性功能"; ObjectID = "lHs-du-a6F"; */
"lHs-du-a6F.title" = "试验性功能";
/* Class = "NSTextFieldCell"; title = "消息撤回样式:"; ObjectID = "mPT-nA-idf"; */
"mPT-nA-idf.title" = "消息撤回样式:";
/* Class = "NSMenuItem"; title = "经典"; ObjectID = "wRC-UO-k1G"; */
"wRC-UO-k1G.title" = "经典";
/* Class = "NSTextFieldCell"; title = "Recall mask color:"; ObjectID = "3xl-c5-YvI"; */
"3xl-c5-YvI.title" = "撤回遮罩颜色";

View File

@ -1,42 +1,15 @@
/* Class = "NSMenuItem"; title = "開啟"; ObjectID = "10G-t9-s4T"; */
"10G-t9-s4T.title" = "開啟";
/* Class = "NSTextFieldCell"; title = "需重啟客戶端"; ObjectID = "2vl-mc-m3L"; */
"2vl-mc-m3L.title" = "需重啟客戶端";
/* Class = "NSMenuItem"; title = "開啟"; ObjectID = "KQg-jN-y9a"; */
"KQg-jN-y9a.title" = "開啟";
/* Class = "NSMenuItem"; title = "關閉"; ObjectID = "MEN-Kg-wfj"; */
"MEN-Kg-wfj.title" = "關閉";
/* Class = "NSTextFieldCell"; title = "消息撤回通知:"; ObjectID = "UKv-CM-nGt"; */
/* Class = "NSTextFieldCell"; title = "Message recalled notification:"; ObjectID = "UKv-CM-nGt"; */
"UKv-CM-nGt.title" = "消息撤回通知:";
/* Class = "NSMenuItem"; title = "關閉"; ObjectID = "Uk9-Oc-Jtv"; */
/* Class = "NSMenuItem"; title = "Disabled"; ObjectID = "Uk9-Oc-Jtv"; */
"Uk9-Oc-Jtv.title" = "關閉";
/* Class = "NSMenuItem"; title = "關閉"; ObjectID = "Vcv-eD-OM9"; */
"Vcv-eD-OM9.title" = "關閉";
/* Class = "NSMenuItem"; title = "全部接收"; ObjectID = "da4-aJ-lEy"; */
/* Class = "NSMenuItem"; title = "All"; ObjectID = "da4-aJ-lEy"; */
"da4-aJ-lEy.title" = "全部接收";
/* Class = "NSMenuItem"; title = "遮罩"; ObjectID = "gH0-wV-Bx0"; */
"gH0-wV-Bx0.title" = "遮罩";
/* Class = "NSMenuItem"; title = "跟隨聊天設置"; ObjectID = "gec-CY-E1x"; */
/* Class = "NSMenuItem"; title = "Inherited"; ObjectID = "gec-CY-E1x"; */
"gec-CY-E1x.title" = "跟隨聊天設置";
/* Class = "NSTextFieldCell"; title = "Alfred JSON 壓縮:"; ObjectID = "jHw-2a-B2t"; */
"jHw-2a-B2t.title" = "Alfred JSON 壓縮:";
/* Class = "NSTextFieldCell"; title = "試驗性功能"; ObjectID = "lHs-du-a6F"; */
"lHs-du-a6F.title" = "試驗性功能";
/* Class = "NSTextFieldCell"; title = "消息撤回樣式:"; ObjectID = "mPT-nA-idf"; */
"mPT-nA-idf.title" = "消息撤回樣式:";
/* Class = "NSMenuItem"; title = "經典"; ObjectID = "wRC-UO-k1G"; */
"wRC-UO-k1G.title" = "經典";
/* Class = "NSTextFieldCell"; title = "Recall mask color:"; ObjectID = "3xl-c5-YvI"; */
"3xl-c5-YvI.title" = "撤回遮罩顏色";

View File

@ -14,7 +14,7 @@
static void __attribute__((constructor)) tweak(void) {
[objc_getClass("CUtility") jr_swizzleClassMethod:NSSelectorFromString(@"HasWechatInstance") withClassMethod:@selector(tweak_HasWechatInstance) error:nil];
[objc_getClass("NSRunningApplication") jr_swizzleClassMethod:NSSelectorFromString(@"runningApplicationsWithBundleIdentifier:") withClassMethod:@selector(tweak_runningApplicationsWithBundleIdentifier:) error:nil];
class_addMethod(objc_getClass("AppDelegate"), @selector(applicationDockMenu:), method_getImplementation(class_getInstanceMethod(objc_getClass("AppDelegate"), @selector(tweak_applicationDockMenu:))), "@:@");
[objc_getClass("AppDelegate") jr_swizzleMethod:NSSelectorFromString(@"applicationDockMenu:") withMethod:@selector(tweak_applicationDockMenu:) error:nil];
}
+ (BOOL)tweak_HasWechatInstance {
@ -30,11 +30,23 @@ static void __attribute__((constructor)) tweak(void) {
}
- (NSMenu *)tweak_applicationDockMenu:(NSApplication *)sender {
NSMenu *menu = [[NSMenu alloc] init];
NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:[NSBundle.tweakBundle localizedStringForKey:@"Tweak.Title.LoginAnotherAccount"]
NSMenu *menu = [self tweak_applicationDockMenu:sender];
NSMenuItem *menuItem = ({
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSBundle.tweakBundle localizedStringForKey:@"Tweak.Title.LoginAnotherAccount"]
action:@selector(openNewWeChatInstace:)
keyEquivalent:@""];
[menu insertItem:menuItem atIndex:0];
item.tag = 9527;
item;
});
__block BOOL added = NO;
[menu.itemArray enumerateObjectsUsingBlock:^(NSMenuItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.tag == 9527) {
*stop = added = YES;
}
}];
if (!added) {
[menu insertItem:menuItem atIndex:0];
}
return menu;
}

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017年 Sunnyyoung. All rights reserved.</string>
</dict>
</plist>

View File

@ -11,24 +11,17 @@
#import <objc/message.h>
#import <JRSwizzle/JRSwizzle.h>
typedef NS_ENUM(NSUInteger, RevokeNotificationType) {
RevokeNotificationTypeFollow = 0,
RevokeNotificationTypeReceiveAll,
RevokeNotificationTypeDisable,
};
typedef NS_ENUM(unsigned int, MessageDataType) {
MessageDataTypeText = 1,
MessageDataTypeImage = 3,
MessageDataTypeVoice = 34,
MessageDataTypeVideo = 43,
MessageDataTypeSticker = 47,
MessageDataTypeLocation = 48,
MessageDataTypeAppUrl = 49,
MessageDataTypePrompt = 10000
};
static NSString * const WeChatTweakPreferenceRevokeNotificationTypeKey = @"WeChatTweakPreferenceRevokeNotificationTypeKey";
@interface NSString (MD5)
- (NSString *)md5String;
@ -127,34 +120,6 @@ static NSString * const WeChatTweakPreferenceRevokeNotificationTypeKey = @"WeCha
@end
@interface MMSessionMgr: NSObject
- (void)loadSessionData;
- (void)loadBrandSessionData;
@end
@interface RevokeMsgItem : NSObject
@property (nonatomic, assign) unsigned int createTime;
@property (nonatomic, retain) NSString *svrId;
@property (nonatomic, retain) NSString *content;
@end
@interface MMRevokeMsgDB : NSObject
- (BOOL)insertRevokeMsg:(id)msg;
- (id)getRevokeMsg:(NSString *)svrId;
@end
@interface MMRevokeMsgService : NSObject
@property (nonatomic, strong) MMRevokeMsgDB *db;
@end
@protocol MASPreferencesViewController <NSObject>
@property(readonly, nonatomic) NSString *toolbarItemLabel;
@ -215,6 +180,19 @@ static NSString * const WeChatTweakPreferenceRevokeNotificationTypeKey = @"WeCha
@end
@interface FFProcessReqsvrZZ : NSObject
- (id)GetMsgData:(id)arg2 localId:(long long)arg3;
- (id)GetMsgData:(id)arg2 svrId:(long long)arg3;
- (void)AddLocalMsg:(id)arg2 msgData:(id)arg3;
- (void)ModifyMsgData:(id)arg2 msgData:(id)arg3;
- (void)notifyAddMsgOnMainThread:(id)arg2 msgData:(id)arg3;
- (void)notifyModMsgOnMainThread:(id)arg2 msgData:(id)arg3;
- (void)notifyDelMsgOnMainThread:(id)arg2 msgData:(id)arg3 isRevoke:(BOOL)arg4;
- (void)notifyUIAndSessionOnMainThread:(id)arg2 withMsg:(id)arg3;
@end
@interface NSDictionary (XMLDictionary)
+ (id)dictionaryWithXMLString:(id)arg1;

View File

@ -22,3 +22,5 @@
"Tweak.MessageMenuItem.IdentifyQRCode" = "Identify QRCode";
"Tweak.MessageMenuItem.IdentifyQRCodeNotification" = "The result of the recognition has been copied to the pasteboard";
"Tweak.MessageMenuItem.ExportSticker" = "Export Sticker";
"Tweak.MessageMenuItem.OpenInGoogleMaps" = "Open in Google Maps";
"Tweak.MessageMenuItem.OpenInAmap" = "Open in Amap";

View File

@ -22,3 +22,5 @@
"Tweak.MessageMenuItem.IdentifyQRCode" = "识别二维码";
"Tweak.MessageMenuItem.IdentifyQRCodeNotification" = "识别结果已复制到粘贴板";
"Tweak.MessageMenuItem.ExportSticker" = "导出表情";
"Tweak.MessageMenuItem.OpenInGoogleMaps" = "使用谷歌地图打开";
"Tweak.MessageMenuItem.OpenInAmap" = "使用高德地图打开";

View File

@ -22,3 +22,5 @@
"Tweak.MessageMenuItem.IdentifyQRCode" = "識別QRCode";
"Tweak.MessageMenuItem.IdentifyQRCodeNotification" = "識別結果已復製到粘貼板";
"Tweak.MessageMenuItem.ExportSticker" = "導出貼圖";
"Tweak.MessageMenuItem.OpenInGoogleMaps" = "使用谷歌地圖打開";
"Tweak.MessageMenuItem.OpenInAmap" = "使用高德地圖打開";

View File

@ -1,210 +0,0 @@
// Copyright (c) 2013, Facebook, Inc.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name Facebook nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific
// prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import "fishhook.h"
#import <dlfcn.h>
#import <stdlib.h>
#import <string.h>
#import <sys/types.h>
#import <mach-o/dyld.h>
#import <mach-o/loader.h>
#import <mach-o/nlist.h>
#ifdef __LP64__
typedef struct mach_header_64 mach_header_t;
typedef struct segment_command_64 segment_command_t;
typedef struct section_64 section_t;
typedef struct nlist_64 nlist_t;
#define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT_64
#else
typedef struct mach_header mach_header_t;
typedef struct segment_command segment_command_t;
typedef struct section section_t;
typedef struct nlist nlist_t;
#define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT
#endif
#ifndef SEG_DATA_CONST
#define SEG_DATA_CONST "__DATA_CONST"
#endif
struct rebindings_entry {
struct rebinding *rebindings;
size_t rebindings_nel;
struct rebindings_entry *next;
};
static struct rebindings_entry *_rebindings_head;
static int prepend_rebindings(struct rebindings_entry **rebindings_head,
struct rebinding rebindings[],
size_t nel) {
struct rebindings_entry *new_entry = (struct rebindings_entry *) malloc(sizeof(struct rebindings_entry));
if (!new_entry) {
return -1;
}
new_entry->rebindings = (struct rebinding *) malloc(sizeof(struct rebinding) * nel);
if (!new_entry->rebindings) {
free(new_entry);
return -1;
}
memcpy(new_entry->rebindings, rebindings, sizeof(struct rebinding) * nel);
new_entry->rebindings_nel = nel;
new_entry->next = *rebindings_head;
*rebindings_head = new_entry;
return 0;
}
static void perform_rebinding_with_section(struct rebindings_entry *rebindings,
section_t *section,
intptr_t slide,
nlist_t *symtab,
char *strtab,
uint32_t *indirect_symtab) {
uint32_t *indirect_symbol_indices = indirect_symtab + section->reserved1;
void **indirect_symbol_bindings = (void **)((uintptr_t)slide + section->addr);
for (uint i = 0; i < section->size / sizeof(void *); i++) {
uint32_t symtab_index = indirect_symbol_indices[i];
if (symtab_index == INDIRECT_SYMBOL_ABS || symtab_index == INDIRECT_SYMBOL_LOCAL ||
symtab_index == (INDIRECT_SYMBOL_LOCAL | INDIRECT_SYMBOL_ABS)) {
continue;
}
uint32_t strtab_offset = symtab[symtab_index].n_un.n_strx;
char *symbol_name = strtab + strtab_offset;
if (strnlen(symbol_name, 2) < 2) {
continue;
}
struct rebindings_entry *cur = rebindings;
while (cur) {
for (uint j = 0; j < cur->rebindings_nel; j++) {
if (strcmp(&symbol_name[1], cur->rebindings[j].name) == 0) {
if (cur->rebindings[j].replaced != NULL &&
indirect_symbol_bindings[i] != cur->rebindings[j].replacement) {
*(cur->rebindings[j].replaced) = indirect_symbol_bindings[i];
}
indirect_symbol_bindings[i] = cur->rebindings[j].replacement;
goto symbol_loop;
}
}
cur = cur->next;
}
symbol_loop:;
}
}
static void rebind_symbols_for_image(struct rebindings_entry *rebindings,
const struct mach_header *header,
intptr_t slide) {
Dl_info info;
if (dladdr(header, &info) == 0) {
return;
}
segment_command_t *cur_seg_cmd;
segment_command_t *linkedit_segment = NULL;
struct symtab_command* symtab_cmd = NULL;
struct dysymtab_command* dysymtab_cmd = NULL;
uintptr_t cur = (uintptr_t)header + sizeof(mach_header_t);
for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) {
cur_seg_cmd = (segment_command_t *)cur;
if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) {
if (strcmp(cur_seg_cmd->segname, SEG_LINKEDIT) == 0) {
linkedit_segment = cur_seg_cmd;
}
} else if (cur_seg_cmd->cmd == LC_SYMTAB) {
symtab_cmd = (struct symtab_command*)cur_seg_cmd;
} else if (cur_seg_cmd->cmd == LC_DYSYMTAB) {
dysymtab_cmd = (struct dysymtab_command*)cur_seg_cmd;
}
}
if (!symtab_cmd || !dysymtab_cmd || !linkedit_segment ||
!dysymtab_cmd->nindirectsyms) {
return;
}
// Find base symbol/string table addresses
uintptr_t linkedit_base = (uintptr_t)slide + linkedit_segment->vmaddr - linkedit_segment->fileoff;
nlist_t *symtab = (nlist_t *)(linkedit_base + symtab_cmd->symoff);
char *strtab = (char *)(linkedit_base + symtab_cmd->stroff);
// Get indirect symbol table (array of uint32_t indices into symbol table)
uint32_t *indirect_symtab = (uint32_t *)(linkedit_base + dysymtab_cmd->indirectsymoff);
cur = (uintptr_t)header + sizeof(mach_header_t);
for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) {
cur_seg_cmd = (segment_command_t *)cur;
if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) {
if (strcmp(cur_seg_cmd->segname, SEG_DATA) != 0 &&
strcmp(cur_seg_cmd->segname, SEG_DATA_CONST) != 0) {
continue;
}
for (uint j = 0; j < cur_seg_cmd->nsects; j++) {
section_t *sect =
(section_t *)(cur + sizeof(segment_command_t)) + j;
if ((sect->flags & SECTION_TYPE) == S_LAZY_SYMBOL_POINTERS) {
perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab);
}
if ((sect->flags & SECTION_TYPE) == S_NON_LAZY_SYMBOL_POINTERS) {
perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab);
}
}
}
}
}
static void _rebind_symbols_for_image(const struct mach_header *header,
intptr_t slide) {
rebind_symbols_for_image(_rebindings_head, header, slide);
}
int rebind_symbols_image(void *header,
intptr_t slide,
struct rebinding rebindings[],
size_t rebindings_nel) {
struct rebindings_entry *rebindings_head = NULL;
int retval = prepend_rebindings(&rebindings_head, rebindings, rebindings_nel);
rebind_symbols_for_image(rebindings_head, (const struct mach_header *) header, slide);
free(rebindings_head);
return retval;
}
int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel) {
int retval = prepend_rebindings(&_rebindings_head, rebindings, rebindings_nel);
if (retval < 0) {
return retval;
}
// If this was the first call, register callback for image additions (which is also invoked for
// existing images, otherwise, just run on existing images
if (!_rebindings_head->next) {
_dyld_register_func_for_add_image(_rebind_symbols_for_image);
} else {
uint32_t c = _dyld_image_count();
for (uint32_t i = 0; i < c; i++) {
_rebind_symbols_for_image(_dyld_get_image_header(i), _dyld_get_image_vmaddr_slide(i));
}
}
return retval;
}

View File

@ -1,76 +0,0 @@
// Copyright (c) 2013, Facebook, Inc.
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name Facebook nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific
// prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef fishhook_h
#define fishhook_h
#include <stddef.h>
#include <stdint.h>
#if !defined(FISHHOOK_EXPORT)
#define FISHHOOK_VISIBILITY __attribute__((visibility("hidden")))
#else
#define FISHHOOK_VISIBILITY __attribute__((visibility("default")))
#endif
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
/*
* A structure representing a particular intended rebinding from a symbol
* name to its replacement
*/
struct rebinding {
const char *name;
void *replacement;
void **replaced;
};
/*
* For each rebinding in rebindings, rebinds references to external, indirect
* symbols with the specified name to instead point at replacement for each
* image in the calling process as well as for all future images that are loaded
* by the process. If rebind_functions is called more than once, the symbols to
* rebind are added to the existing list of rebindings, and if a given symbol
* is rebound more than once, the later rebinding will take precedence.
*/
FISHHOOK_VISIBILITY
int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel);
/*
* Rebinds as above, but only in the specified image. The header should point
* to the mach-o header, the slide should be the slide offset. Others as above.
*/
FISHHOOK_VISIBILITY
int rebind_symbols_image(void *header,
intptr_t slide,
struct rebinding rebindings[],
size_t rebindings_nel);
#ifdef __cplusplus
}
#endif //__cplusplus
#endif //fishhook_h

View File

@ -11,14 +11,15 @@
FOUNDATION_EXPORT double WeChatTweakVersionNumber;
FOUNDATION_EXPORT const unsigned char WeChatTweakVersionString[];
typedef NS_ENUM(NSUInteger, WTRevokedMessageStyle) {
WTRevokedMessageStyleClassic = 0,
WTRevokedMessageStyleMask
typedef NS_ENUM(NSUInteger, WeChatTweakNotificationType) {
WeChatTweakNotificationTypeInherited = 0,
WeChatTweakNotificationTypeReceiveAll,
WeChatTweakNotificationTypeDisable
};
@interface WeChatTweak : NSObject
@property (nonatomic, assign, class) BOOL compressedJSONEnabled;
@property (nonatomic, assign, class) WTRevokedMessageStyle revokedMessageStyle;
@property (class, assign) WeChatTweakNotificationType notificationType;
@property (class, nonnull) NSColor *maskColor;
@end

View File

@ -8,27 +8,24 @@
#import "WeChatTweak.h"
static NSString * const WeChatTweakCompressedJSONEnabledKey = @"WeChatTweakCompressedJSONEnabledKey";
static NSString * const WeChatTweakRevokedMessageStyleKey = @"WeChatTweakRevokedMessageStyleKey";
@implementation WeChatTweak
+ (BOOL)compressedJSONEnabled {
return [NSUserDefaults.standardUserDefaults boolForKey:WeChatTweakCompressedJSONEnabledKey];
+ (WeChatTweakNotificationType)notificationType {
return [NSUserDefaults.standardUserDefaults integerForKey:@"WeChatTweakPreferenceRevokeNotificationTypeKey"];
}
+ (void)setCompressedJSONEnabled:(BOOL)compressedJSONEnabled {
[NSUserDefaults.standardUserDefaults setBool:compressedJSONEnabled forKey:WeChatTweakCompressedJSONEnabledKey];
[NSUserDefaults.standardUserDefaults synchronize];
+ (void)setNotificationType:(WeChatTweakNotificationType)notificationType {
[NSUserDefaults.standardUserDefaults setInteger:notificationType forKey:@"WeChatTweakPreferenceRevokeNotificationTypeKey"];
}
+ (WTRevokedMessageStyle)revokedMessageStyle {
return [NSUserDefaults.standardUserDefaults integerForKey:WeChatTweakRevokedMessageStyleKey];
+ (NSColor *)maskColor {
NSData *data = [NSUserDefaults.standardUserDefaults objectForKey:@"WeChatTweakMaskColor"];
return data ? [NSKeyedUnarchiver unarchiveObjectWithData:data] : [NSColor.systemYellowColor colorWithAlphaComponent:0.3];
}
+ (void)setRevokedMessageStyle:(WTRevokedMessageStyle)revokedMessageStyle {
[NSUserDefaults.standardUserDefaults setInteger:revokedMessageStyle forKey:WeChatTweakRevokedMessageStyleKey];
[NSUserDefaults.standardUserDefaults synchronize];
+ (void)setMaskColor:(NSColor *)maskColor {
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:maskColor];
[NSUserDefaults.standardUserDefaults setObject:data forKey:@"WeChatTweakMaskColor"];
}
@end

13
fishhook.podspec Normal file
View File

@ -0,0 +1,13 @@
Pod::Spec.new do |spec|
spec.name = "fishhook"
spec.version = "0.2"
spec.license = { :type => "BSD", :file => "LICENSE" }
spec.homepage = 'https://github.com/facebook/fishhook'
spec.author = { "Facebook, Inc." => "https://github.com/facebook" }
spec.summary = "A library that enables dynamically rebinding symbols in Mach-O binaries running on iOS."
spec.source = { :git => "https://github.com/facebook/fishhook.git", :tag => '0.2'}
spec.source_files = "fishhook.{h,c}"
spec.social_media_url = 'https://twitter.com/fbOpenSource'
spec.macos.deployment_target = '10.9'
end