Fix anti-revoke message cell mask style issue

This commit is contained in:
Sunnyyoung
2021-05-09 19:12:03 +08:00
parent 7754b578ab
commit b802de5e87
10 changed files with 281 additions and 289 deletions
-25
View File
@@ -1,25 +0,0 @@
//
// RecallCacheManager.h
// WeChatTweak
//
// Created by Sunny Young on 2019/8/29.
// Copyright © 2019 Sunnyyoung. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MMKV/MMKV.h>
@class MessageData;
NS_ASSUME_NONNULL_BEGIN
@interface RecallCacheManager : NSObject
+ (instancetype)sharedInstance;
+ (void)insertRevokedMessage:(MessageData *)message;
+ (BOOL)containsRevokedMessage:(MessageData *)message;
@end
NS_ASSUME_NONNULL_END
-47
View File
@@ -1,47 +0,0 @@
//
// RecallCacheManager.m
// WeChatTweak
//
// Created by Sunny Young on 2019/8/29.
// Copyright © 2019 Sunnyyoung. All rights reserved.
//
#import "RecallCacheManager.h"
#import "WeChatTweakHeaders.h"
@interface RecallCacheManager()
@property (nonatomic, strong) MMKV *kv;
@end
@implementation RecallCacheManager
- (instancetype)init {
if (self = [super init]) {
[MMKV setLogLevel:MMKVLogNone];
_kv = [MMKV mmkvWithID:@"Recall.cache"];
}
return self;
}
+ (instancetype)sharedInstance {
static RecallCacheManager *shared;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
shared = [[RecallCacheManager alloc] init];
});
return shared;
}
+ (void)insertRevokedMessage:(MessageData *)message {
NSString *identifer = [NSString stringWithFormat:@"%ud-%lld-%ud", message.mesLocalID, message.mesSvrID, message.msgCreateTime];
[RecallCacheManager.sharedInstance.kv setBool:YES forKey:identifer];
}
+ (BOOL)containsRevokedMessage:(MessageData *)message {
NSString *identifer = [NSString stringWithFormat:@"%ud-%lld-%ud", message.mesLocalID, message.mesSvrID, message.msgCreateTime];
return [RecallCacheManager.sharedInstance.kv containsKey:identifer];
}
@end
+1 -1
View File
@@ -11,7 +11,7 @@
#import <objc/message.h>
typedef NS_ENUM(NSUInteger, WTRevokedMessageStyle) {
WTRevokedMessageStylePlain = 0,
WTRevokedMessageStyleClassic = 0,
WTRevokedMessageStyleMask
};