fix: 修正房间聊天开关问题 | 修复部分 crash 场景

This commit is contained in:
edwinQQQ
2025-01-02 17:31:17 +08:00
parent ed25b30a35
commit 893c1ab647
11 changed files with 31 additions and 86 deletions

View File

@@ -182,7 +182,8 @@ static int const showtime = 3;
_svgaView.delegate = self;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTapAdViewAction)];
[_svgaView addGestureRecognizer:tap];
[self addSubview:_svgaView];
// [self addSubview:_svgaView];
[self insertSubview:_svgaView belowSubview:self.countdownButton];
SVGAParser *p = [[SVGAParser alloc] init];
@kWeakify(self);
[p parseWithURL:[[NSURL alloc] initFileURLWithPath:filePath] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {

View File

@@ -102,7 +102,7 @@ typedef NS_ENUM(NSInteger, RoomDatingStateChangeType) {
@property (nonatomic , copy) NSString * avatar;
@property (nonatomic , assign) NSInteger onlineNum;
@property (nonatomic , assign) BOOL isCloseScreen;
@property(nonatomic,assign) BOOL closeScreen;
//@property(nonatomic,assign) BOOL closeScreen;
@property (nonatomic , assign) BOOL exceptionClose;
@property (nonatomic , assign) PermitRoomType isPermitRoom;
@property (nonatomic , assign) NSInteger abChannelType;

View File

@@ -13,8 +13,8 @@
@implementation RoomInfoModel
-(void)setCloseScreen:(BOOL)closeScreen{
_closeScreen = closeScreen;
_isCloseScreen = _closeScreen;
}
//-(void)setCloseScreen:(BOOL)closeScreen{
// _closeScreen = closeScreen;
// _isCloseScreen = _closeScreen;
//}
@end

View File

@@ -53,7 +53,11 @@
[self processNextGift];
});
[self processNextGift];
dispatch_async(dispatch_get_main_queue(), ^{
@kStrongify(self);
[self processNextGift];
});
dispatch_resume(timer);
self.giftTimer = timer;
@@ -67,7 +71,9 @@
GiftReceiveInfoModel *giftInfo = self.giftQueue.firstObject;
[self distributeGiftAnimation:giftInfo];
[self.giftQueue removeObjectAtIndex:0];
if (self.giftQueue.count > 0) {
[self.giftQueue removeObjectAtIndex:0];
}
}
- (void)distributeGiftAnimation:(GiftReceiveInfoModel *)giftInfo {

View File

@@ -114,7 +114,7 @@ UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey;
switch (type) {
case XPRoomMenuItemType_Input:
{
if (self.delegate.getRoomInfo.isCloseScreen && self.delegate.getPublicScreenType == 0) {
if (self.delegate.getRoomInfo.isCloseScreen){//} && self.delegate.getPublicScreenType == 0) {
[XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"XPRoomMenuContainerView0")];
return;
}

View File

@@ -848,13 +848,13 @@
if (dic.allKeys.count <=0) {
dic = attachment.data;
}
RoomInfoModel * roomInfo = [RoomInfoModel modelWithDictionary:dic];
RoomInfoModel *roomInfo = [RoomInfoModel modelWithDictionary:dic];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser45") color:[DJDKMIMOMColor messageNickColor] font:kRoomMessageDefalutFont]];
if (roomInfo.isCloseScreen) {
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser46") color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser46") color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
} else {
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser47") color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser47") color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
}
messageInfo.content = attribute;
} else if(attachment.second == Custom_Message_Sub_Update_RoomInfo_AnimateEffect) {

View File

@@ -55,18 +55,6 @@
attributes:attributedTextCopy
range:range];
[self updateLayoutWithAttributedText:attributedTextCopy];
// if (self.updateLayoutSize) {
// if (isMSRTL()) {
// CGSize size = [attributedTextCopy boundingRectWithSize:maxSize
// options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
// context:nil].size;
// self.updateLayoutSize(size);
// }else {
// YYTextLayout *lastlayout = [YYTextLayout layoutWithContainerSize:maxSize
// text:attributedTextCopy];
// self.updateLayoutSize(lastlayout.textBoundingSize);
// }
// }
} else {
@kWeakify(self);
[imageView loadImage:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {

View File

@@ -156,25 +156,11 @@
if (self.isLeftBigImage) {
self.leftBigImageView.imageUrl = messageInfo.boomImageUrl;
} else {
// [self updateLayout];
}
}
}
//- (void)updateLayout {
// if ([NSString isEmpty:self.messageInfo.bubbleImageUrl]) {
// [self updateLayoutWithoutBubble:![NSString isEmpty:self.messageInfo.bubbleImageUrl]];
// }else {
// [self updateLayoutWithBubble];
// }
//
// [self.contentView setNeedsLayout];
// [self.contentView layoutIfNeeded];
//}
- (void)updateLayoutWithBubble {
// self.blurEffectView.hidden = !self.messageInfo.isHiddenBubble;
@kWeakify(self);
[self.bubbleImageView loadImageWithUrl:self.messageInfo.bubbleImageUrl
completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
@@ -183,21 +169,6 @@
UIImage *cutImage = [image1 cropRightAndBottomPixels:2];
self.bubbleImageView.image = [self resizableImage:cutImage];
}];
// [self.contentLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.leading.mas_equalTo(self.messageInfo.contentLeftMargin);
// make.top.mas_equalTo(0);//self.messageInfo.contentTopMargin);
// make.bottom.mas_equalTo(- self.messageInfo.cellBottomMargin);
//// make.width.mas_equalTo([self RTLLabelWidth]);
// //
// make.width.mas_lessThanOrEqualTo([self RTLLabelWidth]).priority(UILayoutPriorityDefaultHigh); // 使
// make.trailing.mas_lessThanOrEqualTo(self.contentView).offset(-self.messageInfo.contentLeftMargin).priority(UILayoutPriorityRequired); // 使
// }];
// [self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.center.mas_equalTo(self.contentLabel);
// make.size.mas_equalTo(self.contentLabel).multipliedBy(1.2);
// }];
}
- (void)updateLayoutWithoutBubble:(BOOL)hasBubble layoutSize:(CGSize)size {
@@ -207,9 +178,6 @@
make.top.mas_equalTo(self.messageInfo.contentTopMargin);
make.bottom.mas_equalTo(-self.messageInfo.cellBottomMargin);
make.leading.mas_equalTo(self.messageInfo.contentLeftMargin);
// make.width.mas_equalTo([self RTLLabelWidth]);
//
// make.width.mas_lessThanOrEqualTo([self RTLLabelWidth]).priority(UILayoutPriorityDefaultHigh); // 使
make.width.mas_lessThanOrEqualTo(size.width).priority(UILayoutPriorityDefaultHigh); // 使
//
make.trailing.mas_lessThanOrEqualTo(self.contentView).offset(-self.messageInfo.contentLeftMargin).priority(UILayoutPriorityRequired); // 使
@@ -224,21 +192,13 @@
UIImage *cutImage = [image1 cropRightAndBottomPixels:2];
self.bubbleImageView.image = [self resizableImage:cutImage];
[self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.center.mas_equalTo(self.contentLabel);
// make.size.mas_equalTo(self.contentLabel).multipliedBy(1.2);
// make.centerY.mas_equalTo(self.contentLabel);
// make.height.mas_equalTo(size.height).multipliedBy(1.2);
make.top.bottom.mas_equalTo(self.contentLabel).inset(-4);
make.leading.trailing.mas_equalTo(self.contentLabel).inset(-16);
// make.leading.mas_equalTo(self.contentLabel).offset(-16);
// make.trailing.mas_equalTo(self.contentLabel).offset(16);
}];
}];
} else {
self.bubbleImageView.image = [UIImage imageWithColor:[DJDKMIMOMColor messageBubbleColor]];
[self.bubbleImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.top.bottom.mas_equalTo(self.contentLabel).inset(-4);
// make.leading.trailing.mas_equalTo(self.contentLabel).inset(-16);
make.top.bottom.mas_equalTo(self.contentLabel);
make.leading.mas_equalTo(self.contentLabel).offset(-self.messageInfo.contentLeftMargin);
make.trailing.mas_equalTo(self.contentLabel).offset(self.messageInfo.contentLeftMargin);
@@ -246,24 +206,6 @@
}
}
- (CGSize)RTLLabelSize {
CGSize maxSize = CGSizeMake(kRoomMessageMaxWidth - 24, MAXFLOAT);
YYTextLayout *layout = [YYTextLayout layoutWithContainerSize:maxSize
text:self.contentLabel.attributedText];
return layout.textBoundingSize;
return [self.contentLabel.attributedText boundingRectWithSize:CGSizeMake(kRoomMessageMaxWidth, 0)
options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin
context:nil].size;
}
- (CGFloat)RTLLabelWidth {
return MIN(ceil([self RTLLabelSize].width) + self.messageInfo.contentLeftMargin,
kRoomMessageMaxWidth - self.messageInfo.contentLeftMargin);
}
- (CGFloat)RTLLabelHeight {
return ceil([self RTLLabelSize].height);
}
- (void)setRoomType:(RoomType)roomType {
_roomType = roomType;
if (self.messageInfo.bubbleImageUrl.length > 0) {

View File

@@ -39,7 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
- (NSArray *)getRoomPKGroupTeamList;
///房间内PK是否正在进行
- (BOOL)isRoomPKPlaying;
-(BOOL)getIsMiniEnter;
- (BOOL)getIsMiniEnter;
///屏蔽
-(void)requesstShieldingAction;
@@ -53,6 +53,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)displayMusicPanel;
- (void)updateScreenMessageState:(BOOL)isClose;
@end
NS_ASSUME_NONNULL_END

View File

@@ -89,8 +89,6 @@
[self initSubViewConstraints];
}
#pragma mark - Private Method
- (void)initSubViews {
self.title = YMLocalizedString(@"XPRoomSettingViewController0");
@@ -447,7 +445,6 @@ XPRoomSettingItemModel * itemModel = [[self.datasource xpSafeObjectAtIndex:index
[TTPopup alertWithConfig:config confirmHandler:^{
[self.presenter updateRoomMessageScreenState:YES roomId:roomId];
} cancelHandler:^{
[switchView setOn:!switchView.isOn];
}];
}
@@ -561,6 +558,11 @@ XPRoomSettingItemModel * itemModel = [[self.datasource xpSafeObjectAtIndex:index
}
- (void)updateRoomMessageScreenStateSuccess:(RoomInfoModel *)roomInfo {
if (self.hostDelegate) {
[self.hostDelegate updateScreenMessageState:roomInfo.isCloseScreen];
}
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
[self.presenter getRoomInfo:roomUid];
///

View File

@@ -2692,6 +2692,10 @@ XPCandyTreeInsufficientBalanceViewDelegate>
[self.functionView showMusicPanel];
}
- (void)updateScreenMessageState:(BOOL)isClose {
self.roomInfo.isCloseScreen = isClose;
}
#pragma mark - XPFirstRechargeViewDelegate
-(void)rechargeHandle{}
-(void)contactCustomerService{