mirror of
https://github.com/Sunnyyoung/WeChatTweak-macOS.git
synced 2025-05-24 07:16:10 +08:00
Rename
This commit is contained in:
parent
2eb9aafccb
commit
9e45c60a81
Binary file not shown.
|
@ -5,9 +5,9 @@
|
||||||
|
|
||||||
__attribute__((constructor))
|
__attribute__((constructor))
|
||||||
static void initializer(void) {
|
static void initializer(void) {
|
||||||
Class messageServiceClass = NSClassFromString(@"MessageService");
|
Class MessageServiceClass = NSClassFromString(@"MessageService");
|
||||||
SEL onRevokeMsgSEL = NSSelectorFromString(@"onRevokeMsg:");
|
SEL onRevokeMsgSEL = NSSelectorFromString(@"onRevokeMsg:");
|
||||||
IMP hookIMP = imp_implementationWithBlock(^(id self, id arg) {
|
IMP onRevokeMsgIMP = imp_implementationWithBlock(^(id self, id arg) {
|
||||||
NSString *message = (NSString *)arg;
|
NSString *message = (NSString *)arg;
|
||||||
NSRange begin = [message rangeOfString:@"<replacemsg><![CDATA["];
|
NSRange begin = [message rangeOfString:@"<replacemsg><![CDATA["];
|
||||||
NSRange end = [message rangeOfString:@"]]></replacemsg>"];
|
NSRange end = [message rangeOfString:@"]]></replacemsg>"];
|
||||||
|
@ -20,6 +20,6 @@ static void initializer(void) {
|
||||||
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:userNotification];
|
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:userNotification];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Method originMethod = class_getInstanceMethod(messageServiceClass, onRevokeMsgSEL);
|
Method onRevokeMsgMethod = class_getInstanceMethod(MessageServiceClass, onRevokeMsgSEL);
|
||||||
IMP originImp = class_replaceMethod(messageServiceClass, onRevokeMsgSEL, hookIMP, method_getTypeEncoding(originMethod));
|
class_replaceMethod(MessageServiceClass, onRevokeMsgSEL, onRevokeMsgIMP, method_getTypeEncoding(onRevokeMsgMethod));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user