mirror of
https://github.com/Sunnyyoung/WeChatTweak-macOS.git
synced 2026-07-28 22:14:33 +08:00
Fix #186
This commit is contained in:
@@ -9,14 +9,16 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <MMKV/MMKV.h>
|
||||
|
||||
@class MessageData;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface RecallCacheManager : NSObject
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
+ (void)insertRevokedMessageID:(long long)messageID;
|
||||
+ (BOOL)containsRevokedMessageID:(long long)messageID;
|
||||
+ (void)insertRevokedMessage:(MessageData *)message;
|
||||
+ (BOOL)containsRevokedMessage:(MessageData *)message;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#import "RecallCacheManager.h"
|
||||
#import "WeChatTweakHeaders.h"
|
||||
|
||||
@interface RecallCacheManager()
|
||||
|
||||
@@ -33,12 +34,14 @@
|
||||
return shared;
|
||||
}
|
||||
|
||||
+ (void)insertRevokedMessageID:(long long)messageID {
|
||||
[RecallCacheManager.sharedInstance.kv setBool:YES forKey:@(messageID).stringValue];
|
||||
+ (void)insertRevokedMessage:(MessageData *)message {
|
||||
NSString *identifer = [NSString stringWithFormat:@"%lld-%ud", message.mesSvrID, message.msgCreateTime];
|
||||
[RecallCacheManager.sharedInstance.kv setBool:YES forKey:identifer];
|
||||
}
|
||||
|
||||
+ (BOOL)containsRevokedMessageID:(long long)messageID {
|
||||
return [RecallCacheManager.sharedInstance.kv containsKey:@(messageID).stringValue];
|
||||
+ (BOOL)containsRevokedMessage:(MessageData *)message {
|
||||
NSString *identifer = [NSString stringWithFormat:@"%lld-%ud", message.mesSvrID, message.msgCreateTime];
|
||||
return [RecallCacheManager.sharedInstance.kv containsKey:identifer];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -100,7 +100,7 @@ static void __attribute__((constructor)) tweak(void) {
|
||||
|
||||
- (void)tweak_populateWithMessage:(MMMessageTableItem *)tableItem {
|
||||
[self tweak_populateWithMessage:tableItem];
|
||||
BOOL style = [RecallCacheManager containsRevokedMessageID:tableItem.message.mesSvrID] && tableItem.message.messageType != MessageDataTypePrompt;
|
||||
BOOL style = [RecallCacheManager containsRevokedMessage:tableItem.message] && tableItem.message.messageType != MessageDataTypePrompt;
|
||||
[((MMMessageCellView *)self).subviews enumerateObjectsUsingBlock:^(__kindof NSView * _Nonnull view, NSUInteger index, BOOL * _Nonnull stop) {
|
||||
if (view.tag != 9527) {
|
||||
return ;
|
||||
@@ -144,7 +144,7 @@ static void __attribute__((constructor)) tweak(void) {
|
||||
|
||||
// Get message data
|
||||
MessageData *messageData = [((MessageService *)self) GetMsgData:session svrId:newMessageID];
|
||||
[RecallCacheManager insertRevokedMessageID:messageData.mesSvrID];
|
||||
[RecallCacheManager insertRevokedMessage:messageData];
|
||||
|
||||
// Prepare notification information
|
||||
MMServiceCenter *serviceCenter = [objc_getClass("MMServiceCenter") defaultCenter];
|
||||
|
||||
Reference in New Issue
Block a user