cdts/xdts-ios 3/TreeHole/Code/Features/Chat/UIPatch/TUIImageMessageCellData+TUIPatch.m
2023-07-27 09:20:00 +08:00

37 lines
1.0 KiB
Objective-C

//
// 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