This commit is contained in:
Sunnyyoung
2019-11-21 15:32:55 +08:00
parent 349d1dec18
commit dac0ba487f
9 changed files with 40 additions and 28 deletions
+4 -2
View File
@@ -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 -4
View File
@@ -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