mirror of
https://github.com/Sunnyyoung/WeChatTweak-macOS.git
synced 2025-05-25 00:16:07 +08:00
Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1eee214417 | ||
![]() |
df0ffb2550 | ||
![]() |
850dc6d1b1 | ||
![]() |
724c217710 | ||
![]() |
d4eba24e4a | ||
![]() |
8b3dcc24a0 | ||
![]() |
e2300d8edb | ||
![]() |
5bf1f8a62d | ||
![]() |
3c6f1cbe66 | ||
![]() |
3a8c581c5e | ||
![]() |
5d82b85a0f | ||
![]() |
65e6346f03 | ||
![]() |
ad0cd57059 | ||
![]() |
02e2100c8f | ||
![]() |
c8178e3121 | ||
![]() |
ddf9e51acd | ||
![]() |
f72f4c3f77 | ||
![]() |
3b56f88758 | ||
![]() |
fe77da4ae8 | ||
![]() |
676ebff036 | ||
![]() |
3685d28592 | ||
![]() |
46315d09d1 | ||
![]() |
9bf679f8f7 |
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -143,4 +143,5 @@ fastlane/FastlaneRunner
|
|||
### Project ###
|
||||
|
||||
Gems
|
||||
WeChatTweak.xcarchive
|
||||
WeChatTweak.framework
|
||||
|
|
|
@ -1 +1 @@
|
|||
2.7.7
|
||||
2.7.8
|
||||
|
|
53
Gemfile.lock
53
Gemfile.lock
|
@ -1,26 +1,35 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (3.0.6)
|
||||
CFPropertyList (3.0.7)
|
||||
base64
|
||||
nkf
|
||||
rexml
|
||||
activesupport (7.0.4.3)
|
||||
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)
|
||||
addressable (2.8.4)
|
||||
public_suffix (>= 2.0.2, < 6.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.12.1)
|
||||
cocoapods (1.15.2)
|
||||
addressable (~> 2.8)
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
cocoapods-core (= 1.12.1)
|
||||
cocoapods-core (= 1.15.2)
|
||||
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
||||
cocoapods-downloader (>= 1.6.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.6.0, < 2.0)
|
||||
|
@ -32,8 +41,8 @@ GEM
|
|||
molinillo (~> 0.8.0)
|
||||
nap (~> 1.0)
|
||||
ruby-macho (>= 2.3.0, < 3.0)
|
||||
xcodeproj (>= 1.21.0, < 2.0)
|
||||
cocoapods-core (1.12.1)
|
||||
xcodeproj (>= 1.23.0, < 2.0)
|
||||
cocoapods-core (1.15.2)
|
||||
activesupport (>= 5.0, < 8)
|
||||
addressable (~> 2.8)
|
||||
algoliasearch (~> 1.0)
|
||||
|
@ -44,7 +53,7 @@ GEM
|
|||
public_suffix (~> 4.0)
|
||||
typhoeus (~> 1.0)
|
||||
cocoapods-deintegrate (1.0.5)
|
||||
cocoapods-downloader (1.6.3)
|
||||
cocoapods-downloader (2.1)
|
||||
cocoapods-plugins (1.0.0)
|
||||
nap
|
||||
cocoapods-search (1.0.1)
|
||||
|
@ -53,31 +62,37 @@ GEM
|
|||
netrc (~> 0.11)
|
||||
cocoapods-try (1.2.0)
|
||||
colored2 (3.1.2)
|
||||
concurrent-ruby (1.2.2)
|
||||
concurrent-ruby (1.3.3)
|
||||
connection_pool (2.4.1)
|
||||
drb (2.2.1)
|
||||
escape (0.0.4)
|
||||
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.13.0)
|
||||
i18n (1.14.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
json (2.6.3)
|
||||
minitest (5.18.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)
|
||||
nkf (0.2.0)
|
||||
public_suffix (4.0.7)
|
||||
rexml (3.2.5)
|
||||
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.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
xcodeproj (1.22.0)
|
||||
xcodeproj (1.24.0)
|
||||
CFPropertyList (>= 2.3.3, < 4.0)
|
||||
atomos (~> 0.1.3)
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
|
@ -92,4 +107,4 @@ DEPENDENCIES
|
|||
cocoapods
|
||||
|
||||
BUNDLED WITH
|
||||
2.4.12
|
||||
2.4.19
|
||||
|
|
27
Makefile
27
Makefile
|
@ -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."
|
||||
|
|
5
Podfile
5
Podfile
|
@ -1,16 +1,17 @@
|
|||
platform :osx, '10.12'
|
||||
platform :macos, '10.13'
|
||||
inhibit_all_warnings!
|
||||
|
||||
target 'WeChatTweak' do
|
||||
pod 'JRSwizzle'
|
||||
pod 'GCDWebServer'
|
||||
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.delete 'ARCHS'
|
||||
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = 10.12
|
||||
config.build_settings.delete 'MACOSX_DEPLOYMENT_TARGET'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
15
Podfile.lock
15
Podfile.lock
|
@ -1,10 +1,12 @@
|
|||
PODS:
|
||||
- fishhook (0.2)
|
||||
- GCDWebServer (3.5.4):
|
||||
- GCDWebServer/Core (= 3.5.4)
|
||||
- GCDWebServer/Core (3.5.4)
|
||||
- JRSwizzle (1.0)
|
||||
- JRSwizzle (2.0.0)
|
||||
|
||||
DEPENDENCIES:
|
||||
- fishhook (from `fishhook.podspec`)
|
||||
- GCDWebServer
|
||||
- JRSwizzle
|
||||
|
||||
|
@ -13,10 +15,15 @@ SPEC REPOS:
|
|||
- GCDWebServer
|
||||
- JRSwizzle
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
fishhook:
|
||||
:podspec: fishhook.podspec
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
fishhook: 415495c4be055473f437f0755286ae99e22d18da
|
||||
GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
|
||||
JRSwizzle: dd5ead5d913a0f29e7f558200165849f006bb1e3
|
||||
JRSwizzle: 7a6fdfe05231e2de26eb14835622d4c6c20c0b6c
|
||||
|
||||
PODFILE CHECKSUM: 22ef49086b2b3fff4ce56e9b03025f28416919ba
|
||||
PODFILE CHECKSUM: 2882fbedfd770003d6828a279714d6ce0ef9a985
|
||||
|
||||
COCOAPODS: 1.12.1
|
||||
COCOAPODS: 1.15.2
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
A dynamic library tweak for WeChat macOS.
|
||||
|
||||

|
||||
|
||||
## 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
|
||||
|
||||

|
||||
|
||||
### Alfred workflow
|
||||
|
||||

|
||||
|
||||
### LaunchBar action
|
||||
|
||||

|
||||
```bash
|
||||
sudo wechattweak-cli install # Install/Uninstall
|
||||
sudo wechattweak-cli uninstall # Uninstall
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
|
|
55
README.md
55
README.md
|
@ -7,6 +7,8 @@
|
|||
|
||||
微信 macOS 客户端增强 Tweak 动态库。
|
||||
|
||||

|
||||
|
||||
## 功能
|
||||
|
||||
- 阻止消息撤回
|
||||
|
@ -23,6 +25,7 @@
|
|||
- 支持由系统默认浏览器直接打开
|
||||
- ~~重新打开应用无需手机认证~~(官方已经支持)
|
||||
- UI界面设置面板
|
||||
- 支持 Raycast extension
|
||||
- 支持 Alfred workflow
|
||||
- 支持 Launchbar action
|
||||
|
||||
|
@ -30,48 +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 # 卸载
|
||||
```
|
||||
|
||||
## 截图
|
||||
|
||||
### 整体预览
|
||||
|
||||

|
||||
|
||||
### Alfred workflow
|
||||
|
||||

|
||||
|
||||
### LaunchBar action
|
||||
|
||||

|
||||
```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. 兼容旧版本客户端吗?
|
||||
- 兼容旧版本客户端吗?
|
||||
不,为了降低维护成本和保证更新速度,默认只支持**最新**版本客户端。
|
||||
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) 里找找类似问题并尝试解决。
|
||||
- 截图失效?
|
||||
系统偏好设置 -> 隐私 -> 删除微信并重新添加 -> 重启微信客户端。
|
||||
8. 理性讨论。
|
||||
- 出现`“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
BIN
Screenshot/overview.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 501 KiB |
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 54;
|
||||
objectVersion = 56;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
|
@ -16,8 +16,6 @@
|
|||
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 */; };
|
||||
|
@ -26,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>"; };
|
||||
|
@ -42,14 +40,11 @@
|
|||
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>"; };
|
||||
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>"; };
|
||||
|
@ -57,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 */
|
||||
|
@ -66,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 = (
|
||||
|
@ -100,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";
|
||||
|
@ -124,8 +118,8 @@
|
|||
children = (
|
||||
7DF842291F40583F00D42D79 /* WeChatTweak */,
|
||||
7DF842281F40583F00D42D79 /* Products */,
|
||||
FEFA9C3F34481028661EEC5A /* Pods */,
|
||||
785C3947774E235ED4EB5A14 /* Frameworks */,
|
||||
43C5C16B78FD88F555215AC8 /* Pods */,
|
||||
40D8B49D8195C4EF553380D3 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
|
@ -149,7 +143,6 @@
|
|||
7D64150627A9469900A8A398 /* ContextMenu.m */,
|
||||
7D14E5A21F6447DB00D75132 /* Alfred.h */,
|
||||
7D14E5A31F6447DB00D75132 /* Alfred.m */,
|
||||
7D5AAF3720DF4BB300860EEE /* Vendor */,
|
||||
7D5AAF3620DF4BA400860EEE /* Category */,
|
||||
7D5AAF3520DF4B9700860EEE /* Controller */,
|
||||
7DF842631F40594400D42D79 /* Resources */,
|
||||
|
@ -166,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 */
|
||||
|
@ -184,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 */,
|
||||
|
@ -198,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 */,
|
||||
|
@ -221,8 +204,7 @@
|
|||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = YES;
|
||||
LastUpgradeCheck = 1430;
|
||||
ORGANIZATIONNAME = Sunnyyoung;
|
||||
LastUpgradeCheck = 1540;
|
||||
TargetAttributes = {
|
||||
7DF842261F40583F00D42D79 = {
|
||||
CreatedOnToolsVersion = 8.3.3;
|
||||
|
@ -231,7 +213,7 @@
|
|||
};
|
||||
};
|
||||
buildConfigurationList = 7DF842211F40583F00D42D79 /* Build configuration list for PBXProject "WeChatTweak" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
compatibilityVersion = "Xcode 14.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
|
@ -264,6 +246,28 @@
|
|||
/* 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;
|
||||
|
@ -283,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 */
|
||||
|
@ -313,7 +299,6 @@
|
|||
7D64150827A9469900A8A398 /* ContextMenu.m in Sources */,
|
||||
7D2194CC264701950068F4CC /* AntiRevoke.m in Sources */,
|
||||
7DF842341F4058AB00D42D79 /* WeChatTweak.m in Sources */,
|
||||
7D9049F51F82A41A004E6370 /* fishhook.c in Sources */,
|
||||
7D64151027A94DE200A8A398 /* PreferencesWindow.m in Sources */,
|
||||
7D64150E27A94BEA00A8A398 /* MultipleInstances.m in Sources */,
|
||||
7DF8425C1F4058DD00D42D79 /* NSBundle+WeChatTweak.m in Sources */,
|
||||
|
@ -382,7 +367,8 @@
|
|||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 19;
|
||||
CURRENT_PROJECT_VERSION = 25;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
|
@ -399,8 +385,8 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
MARKETING_VERSION = 1.3.2;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MARKETING_VERSION = 1.5.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
|
@ -442,7 +428,8 @@
|
|||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 19;
|
||||
CURRENT_PROJECT_VERSION = 25;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
|
@ -453,8 +440,8 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
MARKETING_VERSION = 1.3.2;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MARKETING_VERSION = 1.5.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
|
@ -463,17 +450,17 @@
|
|||
};
|
||||
7DF842301F40583F00D42D79 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = A82E6F61C63DBD47219BB308 /* Pods-WeChatTweak.debug.xcconfig */;
|
||||
baseConfigurationReference = C7011C4A6B32C90FC15D183A /* Pods-WeChatTweak.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
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)",
|
||||
|
@ -487,17 +474,17 @@
|
|||
};
|
||||
7DF842311F40583F00D42D79 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = B418F83DA5D4A992F73514A9 /* Pods-WeChatTweak.release.xcconfig */;
|
||||
baseConfigurationReference = BAF38C6487242E521519F1D6 /* Pods-WeChatTweak.release.xcconfig */;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
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)",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1430"
|
||||
LastUpgradeVersion = "1540"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
|
|
@ -12,82 +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 {
|
||||
[self handleRevokedMessageIntoWithSession:session messageData:messageData replaceMessage:replaceMessage];
|
||||
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];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handleRevokedMessageIntoWithSession:(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 == RevokeNotificationTypeInherited && 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 {
|
||||
|
@ -110,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 && tableItem.message.msgStatus == 4 && [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 ;
|
||||
|
@ -119,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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="TweakPreferencesController">
|
||||
<connections>
|
||||
<outlet property="maskColorWell" destination="os7-vb-CNH" id="dYW-6g-0zh"/>
|
||||
<outlet property="notificationTypeButton" destination="6x2-KV-p8w" id="Kfn-2a-Yup"/>
|
||||
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
|
||||
</connections>
|
||||
|
@ -15,49 +16,103 @@
|
|||
<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="56"/>
|
||||
<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="20" 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="14" 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>
|
||||
<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="B87-eD-uhI" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="12" id="9tt-Vb-9e8"/>
|
||||
<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="6x2-KV-p8w" firstAttribute="centerY" secondItem="B87-eD-uhI" secondAttribute="centerY" id="gqp-om-e0O"/>
|
||||
<constraint firstItem="6x2-KV-p8w" firstAttribute="leading" secondItem="B87-eD-uhI" secondAttribute="trailing" constant="8" id="i7Z-7c-5cX"/>
|
||||
<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="146"/>
|
||||
<point key="canvasLocation" x="81" y="166"/>
|
||||
</customView>
|
||||
</objects>
|
||||
</document>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
@interface TweakPreferencesController () <MASPreferencesViewController>
|
||||
|
||||
@property (weak) IBOutlet NSPopUpButton *notificationTypeButton;
|
||||
@property (weak) IBOutlet NSColorWell *maskColorWell;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -19,6 +20,7 @@
|
|||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[NSColorPanel.sharedColorPanel setShowsAlpha:YES];
|
||||
}
|
||||
|
||||
- (void)viewWillAppear {
|
||||
|
@ -27,13 +29,18 @@
|
|||
}
|
||||
|
||||
- (void)reloadData {
|
||||
[self.notificationTypeButton selectItemAtIndex:[NSUserDefaults.standardUserDefaults integerForKey:WeChatTweakPreferenceRevokeNotificationTypeKey]];
|
||||
self.maskColorWell.color = WeChatTweak.maskColor;
|
||||
[self.notificationTypeButton selectItemAtIndex:WeChatTweak.notificationType];
|
||||
}
|
||||
|
||||
#pragma mark - Event method
|
||||
|
||||
- (IBAction)switchNotificationTypeAction:(NSPopUpButton *)sender {
|
||||
[NSUserDefaults.standardUserDefaults setInteger:sender.indexOfSelectedItem forKey:WeChatTweakPreferenceRevokeNotificationTypeKey];
|
||||
WeChatTweak.notificationType = sender.indexOfSelectedItem;
|
||||
}
|
||||
|
||||
- (IBAction)changeMaskColorAction:(NSColorWell *)sender {
|
||||
WeChatTweak.maskColor = sender.color;
|
||||
}
|
||||
|
||||
#pragma mark - MASPreferencesViewController
|
||||
|
|
|
@ -10,3 +10,6 @@
|
|||
|
||||
/* Class = "NSMenuItem"; title = "Inherited"; ObjectID = "gec-CY-E1x"; */
|
||||
"gec-CY-E1x.title" = "Inherited";
|
||||
|
||||
/* Class = "NSTextFieldCell"; title = "Recall mask color:"; ObjectID = "3xl-c5-YvI"; */
|
||||
"3xl-c5-YvI.title" = "Recall mask color:";
|
||||
|
|
|
@ -10,3 +10,6 @@
|
|||
|
||||
/* Class = "NSMenuItem"; title = "Inherited"; ObjectID = "gec-CY-E1x"; */
|
||||
"gec-CY-E1x.title" = "跟随聊天设置";
|
||||
|
||||
/* Class = "NSTextFieldCell"; title = "Recall mask color:"; ObjectID = "3xl-c5-YvI"; */
|
||||
"3xl-c5-YvI.title" = "撤回遮罩颜色";
|
||||
|
|
|
@ -10,3 +10,6 @@
|
|||
|
||||
/* Class = "NSMenuItem"; title = "Inherited"; ObjectID = "gec-CY-E1x"; */
|
||||
"gec-CY-E1x.title" = "跟隨聊天設置";
|
||||
|
||||
/* Class = "NSTextFieldCell"; title = "Recall mask color:"; ObjectID = "3xl-c5-YvI"; */
|
||||
"3xl-c5-YvI.title" = "撤回遮罩顏色";
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -11,24 +11,17 @@
|
|||
#import <objc/message.h>
|
||||
#import <JRSwizzle/JRSwizzle.h>
|
||||
|
||||
typedef NS_ENUM(NSUInteger, RevokeNotificationType) {
|
||||
RevokeNotificationTypeInherited = 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;
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -22,3 +22,5 @@
|
|||
"Tweak.MessageMenuItem.IdentifyQRCode" = "识别二维码";
|
||||
"Tweak.MessageMenuItem.IdentifyQRCodeNotification" = "识别结果已复制到粘贴板";
|
||||
"Tweak.MessageMenuItem.ExportSticker" = "导出表情";
|
||||
"Tweak.MessageMenuItem.OpenInGoogleMaps" = "使用谷歌地图打开";
|
||||
"Tweak.MessageMenuItem.OpenInAmap" = "使用高德地图打开";
|
||||
|
|
|
@ -22,3 +22,5 @@
|
|||
"Tweak.MessageMenuItem.IdentifyQRCode" = "識別QRCode";
|
||||
"Tweak.MessageMenuItem.IdentifyQRCodeNotification" = "識別結果已復製到粘貼板";
|
||||
"Tweak.MessageMenuItem.ExportSticker" = "導出貼圖";
|
||||
"Tweak.MessageMenuItem.OpenInGoogleMaps" = "使用谷歌地圖打開";
|
||||
"Tweak.MessageMenuItem.OpenInAmap" = "使用高德地圖打開";
|
||||
|
|
264
WeChatTweak/Vendor/fishhook.c
vendored
264
WeChatTweak/Vendor/fishhook.c
vendored
|
@ -1,264 +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.
|
||||
|
||||
#include "fishhook.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <mach/mach.h>
|
||||
#include <mach/vm_map.h>
|
||||
#include <mach/vm_region.h>
|
||||
#include <mach-o/dyld.h>
|
||||
#include <mach-o/loader.h>
|
||||
#include <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;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int get_protection(void *addr, vm_prot_t *prot, vm_prot_t *max_prot) {
|
||||
mach_port_t task = mach_task_self();
|
||||
vm_size_t size = 0;
|
||||
vm_address_t address = (vm_address_t)addr;
|
||||
memory_object_name_t object;
|
||||
#ifdef __LP64__
|
||||
mach_msg_type_number_t count = VM_REGION_BASIC_INFO_COUNT_64;
|
||||
vm_region_basic_info_data_64_t info;
|
||||
kern_return_t info_ret = vm_region_64(
|
||||
task, &address, &size, VM_REGION_BASIC_INFO_64, (vm_region_info_64_t)&info, &count, &object);
|
||||
#else
|
||||
mach_msg_type_number_t count = VM_REGION_BASIC_INFO_COUNT;
|
||||
vm_region_basic_info_data_t info;
|
||||
kern_return_t info_ret = vm_region(task, &address, &size, VM_REGION_BASIC_INFO, (vm_region_info_t)&info, &count, &object);
|
||||
#endif
|
||||
if (info_ret == KERN_SUCCESS) {
|
||||
if (prot != NULL)
|
||||
*prot = info.protection;
|
||||
|
||||
if (max_prot != NULL)
|
||||
*max_prot = info.max_protection;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
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;
|
||||
bool symbol_name_longer_than_1 = symbol_name[0] && symbol_name[1];
|
||||
struct rebindings_entry *cur = rebindings;
|
||||
while (cur) {
|
||||
for (uint j = 0; j < cur->rebindings_nel; j++) {
|
||||
if (symbol_name_longer_than_1 && strcmp(&symbol_name[1], cur->rebindings[j].name) == 0) {
|
||||
kern_return_t err;
|
||||
|
||||
if (cur->rebindings[j].replaced != NULL && indirect_symbol_bindings[i] != cur->rebindings[j].replacement)
|
||||
*(cur->rebindings[j].replaced) = indirect_symbol_bindings[i];
|
||||
|
||||
/**
|
||||
* 1. Moved the vm protection modifying codes to here to reduce the
|
||||
* changing scope.
|
||||
* 2. Adding VM_PROT_WRITE mode unconditionally because vm_region
|
||||
* API on some iOS/Mac reports mismatch vm protection attributes.
|
||||
* -- Lianfu Hao Jun 16th, 2021
|
||||
**/
|
||||
err = vm_protect (mach_task_self (), (uintptr_t)indirect_symbol_bindings, section->size, 0, VM_PROT_READ | VM_PROT_WRITE | VM_PROT_COPY);
|
||||
if (err == KERN_SUCCESS) {
|
||||
/**
|
||||
* Once we failed to change the vm protection, we
|
||||
* MUST NOT continue the following write actions!
|
||||
* iOS 15 has corrected the const segments prot.
|
||||
* -- Lionfore Hao Jun 11th, 2021
|
||||
**/
|
||||
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);
|
||||
if (rebindings_head) {
|
||||
free(rebindings_head->rebindings);
|
||||
}
|
||||
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;
|
||||
}
|
75
WeChatTweak/Vendor/fishhook.h
vendored
75
WeChatTweak/Vendor/fishhook.h
vendored
|
@ -1,75 +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
|
|
@ -11,6 +11,15 @@
|
|||
FOUNDATION_EXPORT double WeChatTweakVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char WeChatTweakVersionString[];
|
||||
|
||||
typedef NS_ENUM(NSUInteger, WeChatTweakNotificationType) {
|
||||
WeChatTweakNotificationTypeInherited = 0,
|
||||
WeChatTweakNotificationTypeReceiveAll,
|
||||
WeChatTweakNotificationTypeDisable
|
||||
};
|
||||
|
||||
@interface WeChatTweak : NSObject
|
||||
|
||||
@property (class, assign) WeChatTweakNotificationType notificationType;
|
||||
@property (class, nonnull) NSColor *maskColor;
|
||||
|
||||
@end
|
||||
|
|
|
@ -10,4 +10,22 @@
|
|||
|
||||
@implementation WeChatTweak
|
||||
|
||||
+ (WeChatTweakNotificationType)notificationType {
|
||||
return [NSUserDefaults.standardUserDefaults integerForKey:@"WeChatTweakPreferenceRevokeNotificationTypeKey"];
|
||||
}
|
||||
|
||||
+ (void)setNotificationType:(WeChatTweakNotificationType)notificationType {
|
||||
[NSUserDefaults.standardUserDefaults setInteger:notificationType forKey:@"WeChatTweakPreferenceRevokeNotificationTypeKey"];
|
||||
}
|
||||
|
||||
+ (NSColor *)maskColor {
|
||||
NSData *data = [NSUserDefaults.standardUserDefaults objectForKey:@"WeChatTweakMaskColor"];
|
||||
return data ? [NSKeyedUnarchiver unarchiveObjectWithData:data] : [NSColor.systemYellowColor colorWithAlphaComponent:0.3];
|
||||
}
|
||||
|
||||
+ (void)setMaskColor:(NSColor *)maskColor {
|
||||
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:maskColor];
|
||||
[NSUserDefaults.standardUserDefaults setObject:data forKey:@"WeChatTweakMaskColor"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
13
fishhook.podspec
Normal file
13
fishhook.podspec
Normal 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
|
Loading…
Reference in New Issue
Block a user