40 lines
983 B
Mathematica
40 lines
983 B
Mathematica
|
|
//
|
||
|
|
// 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
|