// // TUIImageMessageCellData+TUIPatch.m // Youth // // Created by mambaxie on 2022/2/20. // #import "TUIImageMessageCellData+TUIPatch.h" #import #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