From 893c1ab6472916f7f9a834a7add45d6200813efd Mon Sep 17 00:00:00 2001 From: edwinQQQ Date: Thu, 2 Jan 2025 17:31:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E6=88=BF=E9=97=B4?= =?UTF-8?q?=E8=81=8A=E5=A4=A9=E5=BC=80=E5=85=B3=E9=97=AE=E9=A2=98=20?= =?UTF-8?q?=EF=BD=9C=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=20crash=20?= =?UTF-8?q?=E5=9C=BA=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YuMi/CustomUI/Adbvertise/XPAdvertiseView.m | 3 +- YuMi/Modules/YMRoom/Model/RoomInfoModel.h | 2 +- YuMi/Modules/YMRoom/Model/RoomInfoModel.m | 8 +-- .../View/AnimationView/GiftAnimationManager.m | 10 +++- .../XPRoomMenuContainerView.m | 2 +- .../Tool/XPRoomMessageParser.m | 6 +- .../View/XPNetImageYYLabel.m | 12 ---- .../View/XPRoomMessageTableViewCell.m | 58 ------------------- YuMi/Modules/YMRoom/View/RoomHostDelegate.h | 4 +- .../View/XPRoomSettingViewController.m | 8 ++- .../YMRoom/View/XPRoomViewController.m | 4 ++ 11 files changed, 31 insertions(+), 86 deletions(-) diff --git a/YuMi/CustomUI/Adbvertise/XPAdvertiseView.m b/YuMi/CustomUI/Adbvertise/XPAdvertiseView.m index 3e9b8337..65c19cdc 100644 --- a/YuMi/CustomUI/Adbvertise/XPAdvertiseView.m +++ b/YuMi/CustomUI/Adbvertise/XPAdvertiseView.m @@ -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) { diff --git a/YuMi/Modules/YMRoom/Model/RoomInfoModel.h b/YuMi/Modules/YMRoom/Model/RoomInfoModel.h index 255daca1..d25efa74 100644 --- a/YuMi/Modules/YMRoom/Model/RoomInfoModel.h +++ b/YuMi/Modules/YMRoom/Model/RoomInfoModel.h @@ -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; diff --git a/YuMi/Modules/YMRoom/Model/RoomInfoModel.m b/YuMi/Modules/YMRoom/Model/RoomInfoModel.m index bbc502cb..d8a56af8 100644 --- a/YuMi/Modules/YMRoom/Model/RoomInfoModel.m +++ b/YuMi/Modules/YMRoom/Model/RoomInfoModel.m @@ -13,8 +13,8 @@ @implementation RoomInfoModel --(void)setCloseScreen:(BOOL)closeScreen{ - _closeScreen = closeScreen; - _isCloseScreen = _closeScreen; -} +//-(void)setCloseScreen:(BOOL)closeScreen{ +// _closeScreen = closeScreen; +// _isCloseScreen = _closeScreen; +//} @end diff --git a/YuMi/Modules/YMRoom/View/AnimationView/GiftAnimationManager.m b/YuMi/Modules/YMRoom/View/AnimationView/GiftAnimationManager.m index c1f449ad..7a6c29c0 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/GiftAnimationManager.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/GiftAnimationManager.m @@ -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 { diff --git a/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomMenuContainerView.m b/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomMenuContainerView.m index 3ee4ad70..ec312d95 100644 --- a/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomMenuContainerView.m +++ b/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomMenuContainerView.m @@ -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; } diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m b/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m index 467ece8b..ceabfc13 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m @@ -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) { diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/View/XPNetImageYYLabel.m b/YuMi/Modules/YMRoom/View/MessageContainerView/View/XPNetImageYYLabel.m index 9e4b16fb..8fd2ef31 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/View/XPNetImageYYLabel.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/View/XPNetImageYYLabel.m @@ -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) { diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/View/XPRoomMessageTableViewCell.m b/YuMi/Modules/YMRoom/View/MessageContainerView/View/XPRoomMessageTableViewCell.m index e10492dd..75fa0b55 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/View/XPRoomMessageTableViewCell.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/View/XPRoomMessageTableViewCell.m @@ -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) { diff --git a/YuMi/Modules/YMRoom/View/RoomHostDelegate.h b/YuMi/Modules/YMRoom/View/RoomHostDelegate.h index 85bd29b7..da03ad14 100644 --- a/YuMi/Modules/YMRoom/View/RoomHostDelegate.h +++ b/YuMi/Modules/YMRoom/View/RoomHostDelegate.h @@ -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 diff --git a/YuMi/Modules/YMRoom/View/Setting/View/XPRoomSettingViewController.m b/YuMi/Modules/YMRoom/View/Setting/View/XPRoomSettingViewController.m index 653d1cbb..3c2fe8ed 100644 --- a/YuMi/Modules/YMRoom/View/Setting/View/XPRoomSettingViewController.m +++ b/YuMi/Modules/YMRoom/View/Setting/View/XPRoomSettingViewController.m @@ -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]; ///发送公屏关闭开启的消息 diff --git a/YuMi/Modules/YMRoom/View/XPRoomViewController.m b/YuMi/Modules/YMRoom/View/XPRoomViewController.m index 24b86dff..3bb02756 100644 --- a/YuMi/Modules/YMRoom/View/XPRoomViewController.m +++ b/YuMi/Modules/YMRoom/View/XPRoomViewController.m @@ -2692,6 +2692,10 @@ XPCandyTreeInsufficientBalanceViewDelegate> [self.functionView showMusicPanel]; } +- (void)updateScreenMessageState:(BOOL)isClose { + self.roomInfo.isCloseScreen = isClose; +} + #pragma mark - XPFirstRechargeViewDelegate -(void)rechargeHandle{} -(void)contactCustomerService{