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

View File

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

View File

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

View File

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

View File

@ -9,14 +9,16 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <MMKV/MMKV.h> #import <MMKV/MMKV.h>
@class MessageData;
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface RecallCacheManager : NSObject @interface RecallCacheManager : NSObject
+ (instancetype)sharedInstance; + (instancetype)sharedInstance;
+ (void)insertRevokedMessageID:(long long)messageID; + (void)insertRevokedMessage:(MessageData *)message;
+ (BOOL)containsRevokedMessageID:(long long)messageID; + (BOOL)containsRevokedMessage:(MessageData *)message;
@end @end

View File

@ -7,6 +7,7 @@
// //
#import "RecallCacheManager.h" #import "RecallCacheManager.h"
#import "WeChatTweakHeaders.h"
@interface RecallCacheManager() @interface RecallCacheManager()
@ -33,12 +34,14 @@
return shared; return shared;
} }
+ (void)insertRevokedMessageID:(long long)messageID { + (void)insertRevokedMessage:(MessageData *)message {
[RecallCacheManager.sharedInstance.kv setBool:YES forKey:@(messageID).stringValue]; NSString *identifer = [NSString stringWithFormat:@"%lld-%ud", message.mesSvrID, message.msgCreateTime];
[RecallCacheManager.sharedInstance.kv setBool:YES forKey:identifer];
} }
+ (BOOL)containsRevokedMessageID:(long long)messageID { + (BOOL)containsRevokedMessage:(MessageData *)message {
return [RecallCacheManager.sharedInstance.kv containsKey:@(messageID).stringValue]; NSString *identifer = [NSString stringWithFormat:@"%lld-%ud", message.mesSvrID, message.msgCreateTime];
return [RecallCacheManager.sharedInstance.kv containsKey:identifer];
} }
@end @end

View File

@ -100,7 +100,7 @@ static void __attribute__((constructor)) tweak(void) {
- (void)tweak_populateWithMessage:(MMMessageTableItem *)tableItem { - (void)tweak_populateWithMessage:(MMMessageTableItem *)tableItem {
[self tweak_populateWithMessage: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) { [((MMMessageCellView *)self).subviews enumerateObjectsUsingBlock:^(__kindof NSView * _Nonnull view, NSUInteger index, BOOL * _Nonnull stop) {
if (view.tag != 9527) { if (view.tag != 9527) {
return ; return ;
@ -144,7 +144,7 @@ static void __attribute__((constructor)) tweak(void) {
// Get message data // Get message data
MessageData *messageData = [((MessageService *)self) GetMsgData:session svrId:newMessageID]; MessageData *messageData = [((MessageService *)self) GetMsgData:session svrId:newMessageID];
[RecallCacheManager insertRevokedMessageID:messageData.mesSvrID]; [RecallCacheManager insertRevokedMessage:messageData];
// Prepare notification information // Prepare notification information
MMServiceCenter *serviceCenter = [objc_getClass("MMServiceCenter") defaultCenter]; MMServiceCenter *serviceCenter = [objc_getClass("MMServiceCenter") defaultCenter];