Commit 8fc659f3 by suolong

修复部分bug。

parent f766ee8e
...@@ -118,21 +118,21 @@ ...@@ -118,21 +118,21 @@
// Params // Params
CGFloat edgeInsets = 8; CGFloat edgeInsets = 8;
UIFont *msgFont = [UIFont fus_themeBoldFont:14]; UIFont *msgFont = [UIFont fus_themeFont:13];
CGSize msgSize = [message boundingRectWithSize:CGSizeMake(UIView.fus_screenW - edgeInsets*12, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:msgFont} context:nil].size; CGSize msgSize = [message boundingRectWithSize:CGSizeMake(UIView.fus_screenW - edgeInsets*12, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:msgFont} context:nil].size;
// DialogView // DialogView
UIView *dialogView = [[UIView alloc] init]; UIView *dialogView = [[UIView alloc] init];
dialogView.layer.cornerRadius = 8; dialogView.layer.cornerRadius = 8;
dialogView.clipsToBounds = YES; dialogView.clipsToBounds = YES;
dialogView.backgroundColor = [UIColor colorWithHex:@"#2C2C2C"]; dialogView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.6];
dialogView.size = CGSizeMake(msgSize.width + edgeInsets*3.5, msgSize.height + edgeInsets*2); dialogView.size = CGSizeMake(msgSize.width + edgeInsets*3.5, msgSize.height + edgeInsets*2);
dialogView.center = CGPointMake(rootView.width*0.5, rootView.height*0.45); dialogView.center = CGPointMake(rootView.width*0.5, rootView.height*0.45);
// MsgLabel // MsgLabel
UILabel *msgLabel = [[UILabel alloc] init]; UILabel *msgLabel = [[UILabel alloc] init];
msgLabel.text = message; msgLabel.text = message;
msgLabel.textColor = [UIColor whiteColor]; msgLabel.textColor = [UIColor colorWithHex:@"#111111"];
msgLabel.font = msgFont; msgLabel.font = msgFont;
msgLabel.numberOfLines = 0; msgLabel.numberOfLines = 0;
msgLabel.size = msgSize; msgLabel.size = msgSize;
......
...@@ -691,7 +691,7 @@ ...@@ -691,7 +691,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements; CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 202506260050; CURRENT_PROJECT_VERSION = 202506260051;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC; DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO; ENABLE_ON_DEMAND_RESOURCES = NO;
...@@ -956,7 +956,7 @@ ...@@ -956,7 +956,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements; CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 202506260050; CURRENT_PROJECT_VERSION = 202506260051;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC; DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO; ENABLE_ON_DEMAND_RESOURCES = NO;
......
...@@ -163,12 +163,60 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor ...@@ -163,12 +163,60 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recieveIMConversationCallDidBeginNotification:) name:FUSChatPublicDefine.fus_imConversationCallDidComeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recieveIMConversationCallDidBeginNotification:) name:FUSChatPublicDefine.fus_imConversationCallDidComeNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveLiveScopeDidChangedNotification:) name:STR(ROOM_CID_LIVE_SCOPE_DID_CHANGED) object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveLiveScopeDidChangedNotification:) name:STR(ROOM_CID_LIVE_SCOPE_DID_CHANGED) object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receivePayRoomRealtimeDataNotification:) name:STR(ROOM_CID_PAYROOM_REALTIME_DATA) object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveNetwortReportNotification:) name:STR(CID_LIVE_ROOM_NETWORK_REPORT) object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveNetwortReportNotification:) name:STR(CID_LIVE_ROOM_NETWORK_REPORT) object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveScreenShotStateNotification:) name:STR(ROOM_CID_RECEIVE_SCREENSHOT_STATE) object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveScreenShotStateNotification:) name:STR(ROOM_CID_RECEIVE_SCREENSHOT_STATE) object:nil];
} }
- (void)receivePayRoomRealtimeDataNotification:(NSNotification *)notification
{
if (self.liveType != FUSLiveTypeAudience || self.roomScopeType != FUSLiveRoomScopeTypePay) {
return;
}
FUSSocketMessageModel *messageModel = notification.object;
NSDictionary *dict = [messageModel fus_getJsonDict];
if (![dict isKindOfClass:NSDictionary.class] || dict.count == 0) {
return;
}
NSString *currentRoomId = [NSString stringWithObject:self.roomInfoModel.roomId];
NSString *incomingRoomId = [NSString stringWithObject:dict[@"roomId"]];
if (![NSString isNull:currentRoomId] && ![NSString isNull:incomingRoomId] && ![currentRoomId isEqualToString:incomingRoomId]) {
return;
}
NSInteger dataType = [dict[@"dataType"] integerValue];
if (dataType != 5) {
return;
}
FUSPayRoomFrostedGlassDataModel *incomingModel = [FUSPayRoomFrostedGlassDataModel fus_modelWithDict:dict];
FUSPayRoomFrostedGlassDataModel *displayModel = self.payRoomCompanionPayloadModel;
if (!displayModel) {
displayModel = [[FUSPayRoomFrostedGlassDataModel alloc] init];
}
if (incomingModel.companionData) {
displayModel.companionData = incomingModel.companionData;
} else if ([dict[@"companionData"] isKindOfClass:NSDictionary.class]) {
displayModel.companionData = [FUSPayRoomCompanionDataModel fus_modelWithDict:dict[@"companionData"]];
}
if (incomingModel.payRoomConfigData) {
displayModel.payRoomConfigData = incomingModel.payRoomConfigData;
} else if ([dict[@"payRoomConfigData"] isKindOfClass:NSDictionary.class]) {
displayModel.payRoomConfigData = [FUSPayRoomFrostedGlassConfigDataModel fus_modelWithDict:dict[@"payRoomConfigData"]];
}
self.payRoomCompanionPayloadModel = displayModel;
dispatch_async(dispatch_get_main_queue(), ^{
FUSPayRoomCompanionPopView *popView = [self fus_currentPayRoomCompanionPopView];
if (!popView) {
[self fus_showPayRoomCompanionPopIfNeededWithRoomId:(currentRoomId ?: incomingRoomId)];
return;
}
[popView fus_updateWithPayRoomData:displayModel];
});
}
/** /**
接收通话开始通知 接收通话开始通知
*/ */
......
...@@ -90,6 +90,11 @@ typedef NS_ENUM(NSInteger, FUSLiveShowTimeCollectFrostedAvatarTapType) { ...@@ -90,6 +90,11 @@ typedef NS_ENUM(NSInteger, FUSLiveShowTimeCollectFrostedAvatarTapType) {
/// @param themeText 最新主题文案,支持 URL 编码字符串 /// @param themeText 最新主题文案,支持 URL 编码字符串
- (void)fus_updateThemeText:(NSString *)themeText; - (void)fus_updateThemeText:(NSString *)themeText;
/// 更新底部额外偏移(用于输入态避让快捷发言等悬浮区域)
/// @param extraOffset 额外上移高度
/// @param animated 是否动画过渡
- (void)fus_updateBottomExtraOffset:(CGFloat)extraOffset animated:(BOOL)animated;
/// 取消按钮点击回调(预留服务端入口) /// 取消按钮点击回调(预留服务端入口)
@property (nonatomic, copy, nullable) void (^cancelHandler)(void); @property (nonatomic, copy, nullable) void (^cancelHandler)(void);
......
...@@ -106,6 +106,8 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10; ...@@ -106,6 +106,8 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
/// 标记倒计时归零事件是否已回调,避免重复触发 /// 标记倒计时归零事件是否已回调,避免重复触发
@property (nonatomic, assign) BOOL didNotifyPerformanceCountdownEnd; @property (nonatomic, assign) BOOL didNotifyPerformanceCountdownEnd;
@property (nonatomic, assign) BOOL didNotifyCollectCountdownEnd; @property (nonatomic, assign) BOOL didNotifyCollectCountdownEnd;
@property (nonatomic, weak) UIView *hostView;
@property (nonatomic, assign) CGFloat bottomExtraOffset;
@end @end
...@@ -126,6 +128,8 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10; ...@@ -126,6 +128,8 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
} }
FUSLiveShowTimeCollectFrostedView *view = [[FUSLiveShowTimeCollectFrostedView alloc] initWithFrame:CGRectMake(0, y, onView.width, kFUSShowTimeFrostedHeight)]; FUSLiveShowTimeCollectFrostedView *view = [[FUSLiveShowTimeCollectFrostedView alloc] initWithFrame:CGRectMake(0, y, onView.width, kFUSShowTimeFrostedHeight)];
view.hostView = onView;
view.bottomExtraOffset = 0;
view.tag = 8817201; view.tag = 8817201;
[onView addSubview:view]; [onView addSubview:view];
return view; return view;
...@@ -195,7 +199,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10; ...@@ -195,7 +199,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
self.showTimeNewTicketLabel = [[UILabel alloc] init]; self.showTimeNewTicketLabel = [[UILabel alloc] init];
self.showTimeNewTicketLabel.font = [UIFont fus_themeBoldFont:12]; self.showTimeNewTicketLabel.font = [UIFont fus_themeBoldFont:12];
self.showTimeNewTicketLabel.textColor = [UIColor colorWithHex:@"#52DDE2"]; self.showTimeNewTicketLabel.textColor = UIColor.whiteColor;
self.showTimeNewTicketLabel.hidden = YES; self.showTimeNewTicketLabel.hidden = YES;
[self.topTicketInfoContainerView addSubview:self.showTimeNewTicketLabel]; [self.topTicketInfoContainerView addSubview:self.showTimeNewTicketLabel];
self.lastNewTicketCount = 0; self.lastNewTicketCount = 0;
...@@ -482,8 +486,10 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10; ...@@ -482,8 +486,10 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
CGFloat clamped = MIN(1.0, MAX(0.0, progress)); CGFloat clamped = MIN(1.0, MAX(0.0, progress));
self.progressLayer.strokeEnd = clamped; self.progressLayer.strokeEnd = clamped;
if (self.stageStatus == 2) { if (self.stageStatus == 2) {
self.progressLabel.textColor = [UIColor colorWithHex:@"#52DDE2"];
self.progressLabel.text = [NSString fus_localString:@"表演中"]; self.progressLabel.text = [NSString fus_localString:@"表演中"];
} else { } else {
self.progressLabel.textColor = UIColor.whiteColor;
self.progressLabel.text = [NSString stringWithFormat:@"%zd%%", (NSInteger)llround(clamped * 100)]; self.progressLabel.text = [NSString stringWithFormat:@"%zd%%", (NSInteger)llround(clamped * 100)];
} }
...@@ -951,6 +957,33 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10; ...@@ -951,6 +957,33 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
[self removeFromSuperview]; [self removeFromSuperview];
} }
- (void)fus_updateBottomExtraOffset:(CGFloat)extraOffset animated:(BOOL)animated {
// 在原始底部锚点基础上增加“额外上移量”,用于避让输入态快捷发言区
UIView *hostView = self.hostView ?: self.superview;
if (!hostView) {
return;
}
self.hostView = hostView;
self.bottomExtraOffset = MAX(0, extraOffset);
CGFloat safeBottom = UIView.fus_SafeBottom;
CGFloat bottomToolH = LIVE_ROOM_BOTTOM_VIEW_HEIGHT;
CGFloat y = hostView.height - safeBottom - bottomToolH - self.bottomExtraOffset - kFUSShowTimeFrostedHeight;
if (y < 0) {
y = 0;
}
CGRect newFrame = CGRectMake(0, y, hostView.width, kFUSShowTimeFrostedHeight);
if (CGRectEqualToRect(self.frame, newFrame)) {
return;
}
if (animated) {
[UIView animateWithDuration:0.25 animations:^{
self.frame = newFrame;
}];
} else {
self.frame = newFrame;
}
}
- (void)dealloc { - (void)dealloc {
// 功能:对象释放时确保停止倒计时,避免计时器泄漏 // 功能:对象释放时确保停止倒计时,避免计时器泄漏
[self fus_stopCountdownTimer]; [self fus_stopCountdownTimer];
......
...@@ -305,7 +305,7 @@ ...@@ -305,7 +305,7 @@
@property (nonatomic, strong) UIView *bottomDividerView; @property (nonatomic, strong) UIView *bottomDividerView;
@property (nonatomic, strong) UILabel *ownedPrefixLabel; @property (nonatomic, strong) UILabel *ownedPrefixLabel;
@property (nonatomic, strong) UILabel *ownedValueLabel; @property (nonatomic, strong) UILabel *ownedValueLabel;
@property (nonatomic, strong) UILabel *mvpBadgeLabel; @property (nonatomic, strong) UIImageView *mvpBadgeImageView;
@property (nonatomic, strong) UILabel *mvpOwnedPrefixLabel; @property (nonatomic, strong) UILabel *mvpOwnedPrefixLabel;
@property (nonatomic, strong) UILabel *mvpOwnedValueLabel; @property (nonatomic, strong) UILabel *mvpOwnedValueLabel;
...@@ -518,15 +518,10 @@ ...@@ -518,15 +518,10 @@
self.ownedValueLabel.text = @"--"; self.ownedValueLabel.text = @"--";
[bottomLeftContentView addSubview:self.ownedValueLabel]; [bottomLeftContentView addSubview:self.ownedValueLabel];
self.mvpBadgeLabel = [[UILabel alloc] initWithFrame:CGRectZero]; self.mvpBadgeImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
self.mvpBadgeLabel.textAlignment = NSTextAlignmentCenter; self.mvpBadgeImageView.contentMode = UIViewContentModeScaleAspectFit;
self.mvpBadgeLabel.font = [UIFont fus_themeBoldFont:10]; self.mvpBadgeImageView.image = [FUSShowRoomCenterBunble imageNamed:@"Live_bottom_mvp"];
self.mvpBadgeLabel.textColor = UIColor.blackColor; [bottomRightContentView addSubview:self.mvpBadgeImageView];
self.mvpBadgeLabel.backgroundColor = [UIColor colorWithHex:@"#52DDE2"];
self.mvpBadgeLabel.text = @"MVP";
self.mvpBadgeLabel.layer.cornerRadius = 8;
self.mvpBadgeLabel.layer.masksToBounds = YES;
[bottomRightContentView addSubview:self.mvpBadgeLabel];
self.mvpOwnedPrefixLabel = [[UILabel alloc] initWithFrame:CGRectZero]; self.mvpOwnedPrefixLabel = [[UILabel alloc] initWithFrame:CGRectZero];
self.mvpOwnedPrefixLabel.font = [UIFont fus_themeFont:12]; self.mvpOwnedPrefixLabel.font = [UIFont fus_themeFont:12];
...@@ -664,15 +659,15 @@ ...@@ -664,15 +659,15 @@
make.right.equalTo(bottomLeftContentView); make.right.equalTo(bottomLeftContentView);
}]; }];
[self.mvpBadgeLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.mvpBadgeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(bottomRightContentView); make.left.equalTo(bottomRightContentView);
make.centerY.equalTo(bottomRightContentView); make.centerY.equalTo(bottomRightContentView);
make.width.mas_equalTo(34); make.width.mas_equalTo(34);
make.height.mas_equalTo(16); make.height.mas_equalTo(14);
}]; }];
[self.mvpOwnedPrefixLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.mvpOwnedPrefixLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.mvpBadgeLabel.mas_right).offset(6); make.left.equalTo(self.mvpBadgeImageView.mas_right).offset(6);
make.centerY.equalTo(bottomRightContentView); make.centerY.equalTo(bottomRightContentView);
}]; }];
......
...@@ -184,6 +184,9 @@ typedef NS_ENUM(NSInteger, FUSFunctionMode) { ...@@ -184,6 +184,9 @@ typedef NS_ENUM(NSInteger, FUSFunctionMode) {
/// 重新刷新底部“主播主题”窗口展示 /// 重新刷新底部“主播主题”窗口展示
- (void)fus_refreshLiveTopicWindow; - (void)fus_refreshLiveTopicWindow;
/// 设置底部“主播主题”窗口显隐(限时表演磨砂条展示时需要隐藏,避免重叠)
- (void)fus_setLiveTopicWindowHidden:(BOOL)hidden;
/** /**
根据 Model 设置 LiveFunctionView 根据 Model 设置 LiveFunctionView
......
...@@ -355,6 +355,12 @@ BDAlphaPlayerMetalViewDelegate ...@@ -355,6 +355,12 @@ BDAlphaPlayerMetalViewDelegate
@property (nonatomic, assign) BOOL requestingAnchorRewardView; @property (nonatomic, assign) BOOL requestingAnchorRewardView;
@property (nonatomic, weak) FusAnchorPayRoomView *anchorPayRoomView; @property (nonatomic, weak) FusAnchorPayRoomView *anchorPayRoomView;
/// 主播付费房面板数据是否已请求过(与旧逻辑一致:首次自动拉取一次)
@property (nonatomic, assign) BOOL didRequestAnchorPayRoomData;
/// 主播付费房面板数据请求中标记(避免重复并发请求)
@property (nonatomic, assign) BOOL isRequestingAnchorPayRoomData;
/// 主播付费房面板最新数据缓存(用于视图重建后直接恢复展示)
@property (nonatomic, copy) NSDictionary *anchorPayRoomDataPayload;
@property (nonatomic, assign) CGRect activityChangeFrame; @property (nonatomic, assign) CGRect activityChangeFrame;
...@@ -1419,9 +1425,106 @@ BDAlphaPlayerMetalViewDelegate ...@@ -1419,9 +1425,106 @@ BDAlphaPlayerMetalViewDelegate
[FusAnchorPayRoomView fus_showAnchorPayRoomViewIfNeeded:^(FusAnchorPayRoomView * _Nonnull view) { [FusAnchorPayRoomView fus_showAnchorPayRoomViewIfNeeded:^(FusAnchorPayRoomView * _Nonnull view) {
view.y = weakSelf.pusherPopularView.bottom; view.y = weakSelf.pusherPopularView.bottom;
weakSelf.anchorPayRoomView = view; weakSelf.anchorPayRoomView = view;
view.requestDataHandler = ^(BOOL force) {
[weakSelf fus_requestAnchorPayRoomDataWithForce:force];
};
if ([weakSelf.anchorPayRoomDataPayload isKindOfClass:NSDictionary.class]) {
[view fus_updateWithPayRoomPayload:weakSelf.anchorPayRoomDataPayload];
}
[weakSelf fus_requestAnchorPayRoomDataWithForce:NO];
}];
}
- (void)fus_requestAnchorPayRoomDataWithForce:(BOOL)force {
if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAnchor || FUSLiveHelper.shareInstance.roomScopeType != FUSLiveRoomScopeTypePay) {
return;
}
if (self.isRequestingAnchorPayRoomData) {
return;
}
if (self.didRequestAnchorPayRoomData && !force) {
return;
}
self.didRequestAnchorPayRoomData = YES;
self.isRequestingAnchorPayRoomData = YES;
NSString *uid = [[FUSCacheDataShare shareStore].userVerifyInfo.uid description];
FUSRoomInfoModel *roomInfoModel = [FUSLiveHelper shareInstance].roomInfoModel;
NSString *roomId = [roomInfoModel.roomId description];
NSString *channelId = [roomInfoModel.channelId description];
NSString *roundId = [roomInfoModel.roundId description];
if ([NSString isNull:roundId]) {
roundId = @"";
}
if ([NSString isNull:uid] || [NSString isNull:roomId] || [NSString isNull:channelId]) {
self.isRequestingAnchorPayRoomData = NO;
self.didRequestAnchorPayRoomData = NO;
return;
}
__weak typeof(self) weakSelf = self;
[FUSLiveHttpHelper fus_requestGetPayRoomDataWithUid:uid RoomId:roomId channelId:channelId roundId:roundId succeed:^(NSDictionary *dataDict) {
NSDictionary *payload = nil;
if ([dataDict[@"data"] isKindOfClass:[NSDictionary class]]) {
payload = dataDict[@"data"];
} else {
payload = dataDict;
}
dispatch_async(dispatch_get_main_queue(), ^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
strongSelf.isRequestingAnchorPayRoomData = NO;
strongSelf.anchorPayRoomDataPayload = ([payload isKindOfClass:NSDictionary.class] ? payload : @{});
if (strongSelf.anchorPayRoomView) {
[strongSelf.anchorPayRoomView fus_updateWithPayRoomPayload:strongSelf.anchorPayRoomDataPayload];
}
});
} failure:^(NSString *msg, NSInteger code) {
dispatch_async(dispatch_get_main_queue(), ^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
strongSelf.isRequestingAnchorPayRoomData = NO;
strongSelf.didRequestAnchorPayRoomData = NO;
});
}]; }];
} }
- (void)fus_receiveAnchorPayRoomRealtimeDataNotification:(NSNotification *)notification {
if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAnchor || FUSLiveHelper.shareInstance.roomScopeType != FUSLiveRoomScopeTypePay) {
return;
}
FUSSocketMessageModel *messageModel = notification.object;
if (!messageModel) {
return;
}
if (![[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] isEqualToString:[NSString stringWithFormat:@"%d", messageModel.extend1]]) {
return;
}
NSDictionary *dict = [messageModel fus_getJsonDict];
NSInteger dataType = [dict[@"dataType"] integerValue];
if (dataType <= 0) {
return;
}
NSMutableDictionary *payload = ([self.anchorPayRoomDataPayload isKindOfClass:NSDictionary.class] ? [self.anchorPayRoomDataPayload mutableCopy] : [NSMutableDictionary dictionary]);
if (dataType == 1 && [dict[@"payViewingData"] isKindOfClass:NSDictionary.class]) {
payload[@"payViewingData"] = dict[@"payViewingData"];
} else if (dataType == 2 && [dict[@"previewData"] isKindOfClass:NSDictionary.class]) {
payload[@"previewData"] = dict[@"previewData"];
} else if (dataType == 3 && [dict[@"incomeData"] isKindOfClass:NSDictionary.class]) {
payload[@"incomeData"] = dict[@"incomeData"];
} else {
return;
}
self.anchorPayRoomDataPayload = payload;
if (self.anchorPayRoomView) {
[self.anchorPayRoomView fus_updateWithPayRoomPayload:self.anchorPayRoomDataPayload];
}
}
/** /**
搭建主播模式 HeadView 搭建主播模式 HeadView
*/ */
...@@ -2662,11 +2765,26 @@ BDAlphaPlayerMetalViewDelegate ...@@ -2662,11 +2765,26 @@ BDAlphaPlayerMetalViewDelegate
- (void)fus_refreshLiveTopicWindow { - (void)fus_refreshLiveTopicWindow {
FUSRoomInfoModel *roomInfoModel = FUSLiveHelper.shareInstance.roomInfoModel; FUSRoomInfoModel *roomInfoModel = FUSLiveHelper.shareInstance.roomInfoModel;
[self fus_setupLiveTopicWindowIfNeeded]; [self fus_setupLiveTopicWindowIfNeeded];
if (roomInfoModel.collectTicket == 1 || roomInfoModel.liveScope == 5) {
self.liveTopicWindowView.hidden = YES;
[self fus_reloadUIWithKeyboardSetPart];
return;
}
self.liveTopicWindowView.hidden = NO; self.liveTopicWindowView.hidden = NO;
[self.liveTopicWindowView fus_updateTopicText:roomInfoModel.introduce restartTimer:YES]; [self.liveTopicWindowView fus_updateTopicText:roomInfoModel.introduce restartTimer:YES];
[self fus_reloadUIWithKeyboardSetPart]; [self fus_reloadUIWithKeyboardSetPart];
} }
- (void)fus_setLiveTopicWindowHidden:(BOOL)hidden {
[self fus_setupLiveTopicWindowIfNeeded];
self.liveTopicWindowView.hidden = hidden;
if (!hidden) {
FUSRoomInfoModel *roomInfoModel = FUSLiveHelper.shareInstance.roomInfoModel;
[self.liveTopicWindowView fus_updateTopicText:roomInfoModel.introduce restartTimer:NO];
}
[self fus_reloadUIWithKeyboardSetPart];
}
/** /**
初始化直播主题底部窗口,并接入展开/收起回调 初始化直播主题底部窗口,并接入展开/收起回调
*/ */
...@@ -2813,8 +2931,8 @@ BDAlphaPlayerMetalViewDelegate ...@@ -2813,8 +2931,8 @@ BDAlphaPlayerMetalViewDelegate
// 接收主播直播拍一拍用户消息 // 接收主播直播拍一拍用户消息
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_receivePatAudienceUpNotification:) name:STR(ROOM_CID_receivePatAudience) object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_receivePatAudienceUpNotification:) name:STR(ROOM_CID_receivePatAudience) object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_receiveAnchorPayRoomRealtimeDataNotification:) name:STR(ROOM_CID_PAYROOM_REALTIME_DATA) object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_receiveGiftInteractSwitchStateDidChangedSocketNotification:) name:STR(ROOM_CID_giftInteractionStateDidChanged) object:nil];
// 监听礼物互动任务变化通知 // 监听礼物互动任务变化通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_receiveGiftInteractTaskChangedNotification:) name:STR(ROOM_CID_GIFT_INTERACT_TASK_CHANGED) object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_receiveGiftInteractTaskChangedNotification:) name:STR(ROOM_CID_GIFT_INTERACT_TASK_CHANGED) object:nil];
// 礼物互动任务列表刷新:收到后用 socket dataList 直刷观众端面板,避免等待接口回包 // 礼物互动任务列表刷新:收到后用 socket dataList 直刷观众端面板,避免等待接口回包
...@@ -7634,6 +7752,9 @@ BDAlphaPlayerMetalViewDelegate ...@@ -7634,6 +7752,9 @@ BDAlphaPlayerMetalViewDelegate
[self fus_updateRewardViewIfNeeded]; [self fus_updateRewardViewIfNeeded];
[self.anchorPayRoomView removeFromSuperview]; [self.anchorPayRoomView removeFromSuperview];
self.anchorPayRoomView = nil; self.anchorPayRoomView = nil;
self.didRequestAnchorPayRoomData = NO;
self.isRequestingAnchorPayRoomData = NO;
self.anchorPayRoomDataPayload = nil;
[self.passwordRoomIconImageView removeFromSuperview]; [self.passwordRoomIconImageView removeFromSuperview];
self.passwordRoomIconImageView = nil; self.passwordRoomIconImageView = nil;
...@@ -7653,6 +7774,9 @@ BDAlphaPlayerMetalViewDelegate ...@@ -7653,6 +7774,9 @@ BDAlphaPlayerMetalViewDelegate
} else { } else {
[self.anchorPayRoomView removeFromSuperview]; [self.anchorPayRoomView removeFromSuperview];
self.anchorPayRoomView = nil; self.anchorPayRoomView = nil;
self.didRequestAnchorPayRoomData = NO;
self.isRequestingAnchorPayRoomData = NO;
self.anchorPayRoomDataPayload = nil;
} }
break; break;
...@@ -7667,6 +7791,9 @@ BDAlphaPlayerMetalViewDelegate ...@@ -7667,6 +7791,9 @@ BDAlphaPlayerMetalViewDelegate
[self.anchorPayRoomView removeFromSuperview]; [self.anchorPayRoomView removeFromSuperview];
self.anchorPayRoomView = nil; self.anchorPayRoomView = nil;
self.didRequestAnchorPayRoomData = NO;
self.isRequestingAnchorPayRoomData = NO;
self.anchorPayRoomDataPayload = nil;
[self fus_showPasswordAnim]; [self fus_showPasswordAnim];
break; break;
......
...@@ -11,9 +11,14 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -11,9 +11,14 @@ NS_ASSUME_NONNULL_BEGIN
@interface FusAnchorPayRoomView : UIView @interface FusAnchorPayRoomView : UIView
/// 外层触发刷新数据(force=YES 对应展开后强制刷新)
@property (nonatomic, copy) void (^requestDataHandler)(BOOL force);
+ (void)fus_showAnchorPayRoomViewIfNeeded:(void(^)(FusAnchorPayRoomView *view))viewHasShowhandler; + (void)fus_showAnchorPayRoomViewIfNeeded:(void(^)(FusAnchorPayRoomView *view))viewHasShowhandler;
/// 外层下发完整数据(/payRoom/getPayRoomData 的 payload 或等价结构)
- (void)fus_updateWithPayRoomPayload:(NSDictionary *)payload;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#import <FUSCommon/FUSCommon.h> #import <FUSCommon/FUSCommon.h>
#import "FUSLiveHelper.h" #import "FUSLiveHelper.h"
#import "FUSLiveHttpHelper.h"
#import "FUSPayRoomViewerPopView.h" #import "FUSPayRoomViewerPopView.h"
@interface FUSPayRoomPayViewingData : FUSBaseModel @interface FUSPayRoomPayViewingData : FUSBaseModel
...@@ -72,8 +71,6 @@ ...@@ -72,8 +71,6 @@
@property (nonatomic, strong) UIView *statsSeparatorView2; @property (nonatomic, strong) UIView *statsSeparatorView2;
@property (nonatomic, strong) UIButton *statsTapButton; @property (nonatomic, strong) UIButton *statsTapButton;
@property (nonatomic, assign) BOOL didRequestPayRoomData;
@property (nonatomic, assign) BOOL isRequestingPayRoomData;
@property (nonatomic, strong) FUSPayRoomGetPayRoomDataModel *payRoomDataModel; @property (nonatomic, strong) FUSPayRoomGetPayRoomDataModel *payRoomDataModel;
@end @end
...@@ -108,9 +105,6 @@ ...@@ -108,9 +105,6 @@
- (instancetype)initWithFrame:(CGRect)frame { - (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_receivePayRoomRealtimeDataNotification:) name:STR(ROOM_CID_PAYROOM_REALTIME_DATA) object:nil];
self.backgroundColor = UIColor.clearColor; self.backgroundColor = UIColor.clearColor;
self.clipsToBounds = NO; self.clipsToBounds = NO;
...@@ -190,7 +184,6 @@ ...@@ -190,7 +184,6 @@
[self.statsBackgroundView addSubview:self.statsSeparatorView2]; [self.statsBackgroundView addSubview:self.statsSeparatorView2];
[self fus_refreshContentTexts]; [self fus_refreshContentTexts];
[self fus_requestPayRoomDataIfNeeded];
self.arrowBtn = [UIButton buttonWithType:UIButtonTypeCustom]; self.arrowBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.arrowBtn.frame = CGRectMake(self.contentView.width, 0, 14, 17); self.arrowBtn.frame = CGRectMake(self.contentView.width, 0, 14, 17);
...@@ -209,10 +202,6 @@ ...@@ -209,10 +202,6 @@
return self; return self;
} }
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)layoutSubviews { - (void)layoutSubviews {
[super layoutSubviews]; [super layoutSubviews];
...@@ -257,69 +246,13 @@ ...@@ -257,69 +246,13 @@
[FUSPayRoomViewerPopView fus_showWithRootView:rootView startIndex:0]; [FUSPayRoomViewerPopView fus_showWithRootView:rootView startIndex:0];
} }
- (void)fus_requestPayRoomDataIfNeeded { - (void)fus_updateWithPayRoomPayload:(NSDictionary *)payload {
[self fus_requestPayRoomDataWithForce:NO]; if (![payload isKindOfClass:NSDictionary.class]) {
}
- (void)fus_requestPayRoomDataWithForce:(BOOL)force {
if (self.isRequestingPayRoomData) {
return; return;
} }
if (self.didRequestPayRoomData) {
if (!force) {
return;
}
} else {
self.didRequestPayRoomData = YES;
}
self.isRequestingPayRoomData = YES;
NSString *uid = [[FUSCacheDataShare shareStore].userVerifyInfo.uid description];
FUSRoomInfoModel *roomInfoModel = [FUSLiveHelper shareInstance].roomInfoModel;
NSString *roomId = [roomInfoModel.roomId description];
NSString *channelId = [roomInfoModel.channelId description];
// roundId:付费房回合ID。用于把“本次付费房回合”的数据精确拉取出来(开播直接选择付费房 / 恢复直播 / 切换为付费房等场景会赋值)。
NSString *roundId = [roomInfoModel.roundId description];
if ([NSString isNull:roundId]) {
roundId = @"";
}
if ([NSString isNull:uid] || [NSString isNull:roomId] || [NSString isNull:channelId]) {
self.isRequestingPayRoomData = NO;
return;
}
__weak typeof(self) weakSelf = self;
[FUSLiveHttpHelper fus_requestGetPayRoomDataWithUid:uid RoomId:roomId channelId:channelId roundId:roundId succeed:^(NSDictionary *dataDict) {
NSDictionary *payload = nil;
if ([dataDict[@"data"] isKindOfClass:[NSDictionary class]]) {
payload = dataDict[@"data"];
} else {
payload = dataDict;
}
FUSPayRoomGetPayRoomDataModel *model = [FUSPayRoomGetPayRoomDataModel fus_modelWithDict:payload]; FUSPayRoomGetPayRoomDataModel *model = [FUSPayRoomGetPayRoomDataModel fus_modelWithDict:payload];
dispatch_async(dispatch_get_main_queue(), ^{ self.payRoomDataModel = model;
__strong typeof(weakSelf) strongSelf = weakSelf; [self fus_refreshContentTexts];
if (!strongSelf) {
return;
}
strongSelf.payRoomDataModel = model;
[strongSelf fus_refreshContentTexts];
strongSelf.isRequestingPayRoomData = NO;
});
} failure:^(NSString *msg, NSInteger code) {
dispatch_async(dispatch_get_main_queue(), ^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
strongSelf.didRequestPayRoomData = NO;
strongSelf.isRequestingPayRoomData = NO;
});
}];
} }
- (NSAttributedString *)fus_infoLineWithTitle:(NSString *)title value:(NSString *)value suffix:(NSString *)suffix { - (NSAttributedString *)fus_infoLineWithTitle:(NSString *)title value:(NSString *)value suffix:(NSString *)suffix {
...@@ -392,45 +325,6 @@ ...@@ -392,45 +325,6 @@
self.incomeLabel.attributedText = [self fus_incomeLineWithValue:incomeValue]; self.incomeLabel.attributedText = [self fus_incomeLineWithValue:incomeValue];
} }
- (void)fus_receivePayRoomRealtimeDataNotification:(NSNotification *)notification {
FUSSocketMessageModel *messageModel = notification.object;
if (!messageModel) {
return;
}
if (![[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] isEqualToString:[NSString stringWithFormat:@"%d", messageModel.extend1]]) {
return;
}
NSDictionary *dict = [messageModel fus_getJsonDict];
NSInteger dataType = [dict[@"dataType"] integerValue];
if (dataType <= 0) {
return;
}
if (!self.payRoomDataModel) {
self.payRoomDataModel = [[FUSPayRoomGetPayRoomDataModel alloc] init];
}
if (dataType == 1) {
NSDictionary *data = dict[@"payViewingData"];
if ([data isKindOfClass:NSDictionary.class]) {
self.payRoomDataModel.payViewingData = [FUSPayRoomPayViewingData fus_modelWithDict:data];
}
} else if (dataType == 2) {
NSDictionary *data = dict[@"previewData"];
if ([data isKindOfClass:NSDictionary.class]) {
self.payRoomDataModel.previewData = [FUSPayRoomPreviewData fus_modelWithDict:data];
}
} else if (dataType == 3) {
NSDictionary *data = dict[@"incomeData"];
if ([data isKindOfClass:NSDictionary.class]) {
self.payRoomDataModel.incomeData = [FUSPayRoomIncomeData fus_modelWithDict:data];
}
}
[self fus_refreshContentTexts];
}
//- (void)fus_recieveGiftChangeNotification:(NSNotification *)notification { //- (void)fus_recieveGiftChangeNotification:(NSNotification *)notification {
// FUSSocketMessageModel *messageModel = notification.object; // FUSSocketMessageModel *messageModel = notification.object;
...@@ -484,7 +378,9 @@ ...@@ -484,7 +378,9 @@
} else { } else {
[self.layer removeAllAnimations]; [self.layer removeAllAnimations];
self.arrowBtn.selected = NO; self.arrowBtn.selected = NO;
[self fus_requestPayRoomDataWithForce:YES]; if (self.requestDataHandler) {
self.requestDataHandler(YES);
}
[UIView animateWithDuration:0.3 animations:^{ [UIView animateWithDuration:0.3 animations:^{
self.transform = CGAffineTransformIdentity; self.transform = CGAffineTransformIdentity;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment