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

40 lines
983 B
Mathematica
Raw Normal View History

2023-07-27 09:20:00 +08:00
//
// V2TIMMessage+TUIPatch.m
// Youth
//
// Created by mambaxie on 2022/1/15.
//
#import "V2TIMMessage+TUIPatch.h"
#import <JRSwizzle.h>
#import "NSObject+BKAssociatedObjects.h"
static NSString * const IsInActivityRoomAssociateKey = @"IsInActivityRoomAssociateKey";
@implementation V2TIMMessage (TUIPatch)
+ (void)load {
NSError *error;
[self jr_swizzleMethod:@selector(patch_isSelf) withMethod:@selector(isSelf) error:&error];
if (error) {
NSLog(@"patch TUI error: %@", error);
}
}
- (void)patch_setIsInActivityRoom:(BOOL)isInActivityRoom {
[self bk_associateValue:@(isInActivityRoom) withKey:(__bridge const void * _Nonnull)(IsInActivityRoomAssociateKey)];
}
- (BOOL)patch_isInActivityRoom {
return [[self bk_associatedValueForKey:(__bridge const void * _Nonnull)(IsInActivityRoomAssociateKey)] boolValue];
}
- (BOOL)patch_isSelf {
if ([self patch_isInActivityRoom]) {
return NO;
}
return [self patch_isSelf];
}
@end