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

View File

@ -1,24 +1,27 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
CFPropertyList (3.0.1)
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
algoliasearch (1.27.1)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.0.3)
cocoapods (1.7.5)
cocoapods (1.8.4)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.7.5)
cocoapods-core (= 1.8.4)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.3.1, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
@ -27,18 +30,20 @@ GEM
molinillo (~> 0.6.6)
nap (~> 1.0)
ruby-macho (~> 1.4)
xcodeproj (>= 1.10.0, < 2.0)
cocoapods-core (1.7.5)
xcodeproj (>= 1.11.1, < 2.0)
cocoapods-core (1.8.4)
activesupport (>= 4.0.2, < 6)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.2.2)
cocoapods-downloader (1.3.0)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.3.1)
cocoapods-trunk (1.4.1)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
@ -48,9 +53,11 @@ GEM
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
minitest (5.11.3)
json (2.2.0)
minitest (5.13.0)
molinillo (0.6.6)
nanaimo (0.2.6)
nap (1.1.0)
@ -59,7 +66,7 @@ GEM
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
xcodeproj (1.12.0)
xcodeproj (1.13.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)

View File

@ -3,7 +3,7 @@ PODS:
- GCDWebServer/Core (= 3.5.3)
- GCDWebServer/Core (3.5.3)
- JRSwizzle (1.0)
- MMKV (1.0.22)
- MMKV (1.0.23)
- YYModel (1.0.4)
DEPENDENCIES:
@ -13,7 +13,7 @@ DEPENDENCIES:
- YYModel
SPEC REPOS:
https://github.com/cocoapods/specs.git:
trunk:
- GCDWebServer
- JRSwizzle
- MMKV
@ -22,9 +22,9 @@ SPEC REPOS:
SPEC CHECKSUMS:
GCDWebServer: c0ab22c73e1b84f358d1e2f74bf6afd1c60829f2
JRSwizzle: dd5ead5d913a0f29e7f558200165849f006bb1e3
MMKV: 99b05c376c0eb412b468ba1d3e6813502edeaa24
MMKV: 031ae51aedc0af1b250922f7ed8a6b6ee2f94c4c
YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30
PODFILE CHECKSUM: fb1b1e412c5f88813595570bd6f951a741cda575
COCOAPODS: 1.7.5
COCOAPODS: 1.8.4

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>18G95</string>
<string>19B88</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
@ -27,17 +27,17 @@
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>11A420a</string>
<string>11B500</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>19A547</string>
<string>19B89</string>
<key>DTSDKName</key>
<string>macosx10.15</string>
<key>DTXcode</key>
<string>1100</string>
<string>1120</string>
<key>DTXcodeBuild</key>
<string>11A420a</string>
<string>11B500</string>
<key>LSMinimumSystemVersion</key>
<string>10.10</string>
<key>NSHumanReadableCopyright</key>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
LastUpgradeVersion = "1120"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

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

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

View File

@ -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];