cdts/xdts-ios 3/TreeHole/Code/Features/Chat/UIPatch/TUIImageMessageCellData+TUIPatch.m

37 lines
1.0 KiB
Mathematica
Raw Normal View History

2023-07-27 09:20:00 +08:00
//
// TUIImageMessageCellData+TUIPatch.m
// Youth
//
// Created by mambaxie on 2022/2/20.
//
#import "TUIImageMessageCellData+TUIPatch.h"
#import <JRSwizzle.h>
#import "NSObject+BKAssociatedObjects.h"
@implementation TUIImageMessageCellData (TUIPatch)
+ (void)load {
NSError *error;
[self jr_swizzleMethod:@selector(patch_getImagePath:isExist:) withMethod:@selector(getImagePath:isExist:) error:&error];
if (error) {
NSLog(@"patch TUI error: %@", error);
}
}
- (NSString *)patch_getImagePath:(int)type isExist:(BOOL *)isExist {
// identifier
BOOL isSelf = !self.identifier || [self.identifier isEqualToString:@(UserService.currentUserID).stringValue];
TMsgDirection originDirection = self.direction;
if (isSelf) { // fix
self.direction = MsgDirectionOutgoing;
}
NSString *result = [self patch_getImagePath:type isExist:isExist];
self.direction = originDirection;
return result;
}
@end