Add recalled message tag UI enhancement

This commit is contained in:
Sunnyyoung
2019-08-30 00:35:47 +08:00
parent ec6823a564
commit fdd4e8ddfe
7 changed files with 167 additions and 60 deletions
+23
View File
@@ -0,0 +1,23 @@
//
// 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>
NS_ASSUME_NONNULL_BEGIN
@interface RecallCacheManager : NSObject
+ (instancetype)sharedInstance;
+ (void)insertRevokedMessageID:(long long)messageID;
+ (BOOL)containsRevokedMessageID:(long long)messageID;
@end
NS_ASSUME_NONNULL_END
+44
View File
@@ -0,0 +1,44 @@
//
// RecallCacheManager.m
// WeChatTweak
//
// Created by Sunny Young on 2019/8/29.
// Copyright © 2019 Sunnyyoung. All rights reserved.
//
#import "RecallCacheManager.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)insertRevokedMessageID:(long long)messageID {
[RecallCacheManager.sharedInstance.kv setBool:YES forKey:@(messageID).stringValue];
}
+ (BOOL)containsRevokedMessageID:(long long)messageID {
return [RecallCacheManager.sharedInstance.kv containsKey:@(messageID).stringValue];
}
@end