Commit 7c0eaf49 by suolong

添加表演结束api,修复点界面ui

parent 60b77571
......@@ -969,6 +969,19 @@ NS_ASSUME_NONNULL_BEGIN
succeed:(void (^)(FUSTicketShowCollectTicketToggleResultModel *model))succeed
failure:(void (^)(NSString *msg, NSInteger code))failure;
/// Ticket Show - 功能 - 主播端表演结束
/// 接口:POST /ticketshow/show/end
/// @param roomId 房间ID
/// @param channelId 频道ID
/// @param roundId 回合ID
/// @param succeed 成功回调(复用 TicketShow 返回模型字段进行存储)
/// @param failure 失败回调(参数错误 code=-3)
+ (void)fus_ticketShowShowEndWithRoomId:(NSString *)roomId
channelId:(NSString *)channelId
roundId:(NSString *)roundId
succeed:(void (^)(FUSTicketShowCollectTicketToggleResultModel *model))succeed
failure:(void (^)(NSString *msg, NSInteger code))failure;
/// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新)
/// @param roomId 房间ID
/// @param channelId 频道ID
......
......@@ -3157,6 +3157,35 @@
}];
}
+ (void)fus_ticketShowShowEndWithRoomId:(NSString *)roomId
channelId:(NSString *)channelId
roundId:(NSString *)roundId
succeed:(void (^)(FUSTicketShowCollectTicketToggleResultModel *model))succeed
failure:(void (^)(NSString *msg, NSInteger code))failure {
NSString *uid = FUSCacheDataShare.shareStore.userDetailInfo.uid;
if ([NSString isNull:uid]
|| [NSString isNull:roomId]
|| [NSString isNull:channelId]
|| [NSString isNull:roundId]) {
if (failure) failure([NSString fus_localString:@"参数错误"], -3);
return;
}
NSDictionary *params = @{
@"uid": uid,
@"roomId": roomId,
@"channelId": channelId,
@"roundId": roundId
};
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_TicketShow_Show_End params:params success:^(NSDictionary * _Nullable dataDict, int code) {
FUSTicketShowCollectTicketToggleResultModel *model = [FUSTicketShowCollectTicketToggleResultModel fus_modelWithDict:dataDict];
if (succeed) succeed(model);
} failure:^(NSDictionary * _Nullable dataDict, int code) {
if (failure) failure(dataDict[@"msg"], code);
}];
}
+ (void)fus_ticketShowProgressGetInfoWithRoomId:(NSString *)roomId
channelId:(NSString *)channelId
roundId:(NSString *)roundId
......
......@@ -33,6 +33,7 @@
#import "FUSLiveRoomThemePopView.h"
#import "FUSLiveShowTimeTicketActionPopView.h"
#import "FUSLiveShowTimeTicketContributionPopView.h"
#import "FUSLiveShowTimeMVPConfirmPopView.h"
#import "FUSLiveShowTimeCancelConfirmPopView.h"
#import "FUSLiveShowTimeFrostCardPopView.h"
#import "FUSLiveFunctionLayerView.h"
......@@ -82,6 +83,12 @@
/// 主播端“票已集齐/取消确认”弹窗倒计时剩余秒数(两层弹窗之间需要延续同一倒计时)
@property (nonatomic, assign) NSInteger showTimeAnchorPopupRemainingSeconds;
/// 记录已触发“表演结束”接口的回合,避免倒计时触底后重复请求
@property (nonatomic, copy) NSString *showTimeShowEndRequestedRoundId;
/// 标记限时表演流程中是否移除了底部 Tool2(用于结束/取消后恢复)
@property (nonatomic, assign) BOOL showTimeDidRemoveTool2;
@end
@implementation FUSLiveChatInputHelper
......@@ -103,6 +110,8 @@
_showTimeReadyShowStartRequestedRoundId = @"";
_isRequestingShowTimeReadyShowStart = NO;
_showTimeAnchorPopupRemainingSeconds = -1;
_showTimeShowEndRequestedRoundId = @"";
_showTimeDidRemoveTool2 = NO;
[self registerReceiptNotification];
......@@ -229,6 +238,71 @@
}
[strongSelf fus_presentShowTimeTicketContributionPopupFromBar:strongBar];
};
bar.performanceCountdownEndHandler = ^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
[strongSelf fus_onShowTimePerformanceCountdownEnd];
};
}
/// 表演阶段倒计时结束:调用结束接口并移除磨砂条
- (void)fus_onShowTimePerformanceCountdownEnd {
if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAnchor) {
return;
}
NSString *roundId = self.showTimeRoundId;
if ([NSString isNull:roundId]) {
return;
}
if (![NSString isNull:self.showTimeShowEndRequestedRoundId] && [self.showTimeShowEndRequestedRoundId isEqualToString:roundId]) {
return;
}
self.showTimeShowEndRequestedRoundId = roundId;
[self fus_destroyShowTimeFrostedIfNeeded];
self.showTimeStageStatus = 9999;
self.showTimeCountdownRemainSeconds = 0;
[self fus_restoreBottomToolButtonsAfterShowTimeIfNeeded];
FUSRoomInfoModel *roomInfoModel = FUSLiveHelper.shareInstance.roomInfoModel;
NSString *roomId = roomInfoModel.roomId;
NSString *channelId = roomInfoModel.channelId;
if ([NSString isNull:roomId] || [NSString isNull:channelId]) {
return;
}
[FUSLiveHttpHelper fus_ticketShowShowEndWithRoomId:roomId channelId:channelId roundId:roundId succeed:^(FUSTicketShowCollectTicketToggleResultModel * _Nonnull model) {
dispatch_async(dispatch_get_main_queue(), ^{
UIView *containerView = [[FUSLiveHelper shareInstance].currentFunctionView fus_viewWithLayer:FUSLiveFunctionLayerManualPopView];
if (!containerView) {
containerView = [UIViewController fus_topViewController].view;
}
if (!containerView) {
return;
}
NSInteger safeFinalTicketNum = MAX(0, model.finalTicketNum);
FUSOnlineUserModel *mvpUser = model.mvpInfo.mvpUserInfo;
NSString *mvpUserId = [NSString stringWithObject:model.mvpInfo.mvpUserId];
NSString *avatarURL = (mvpUser.face.length > 0 ? mvpUser.face : nil);
NSString *nickname = nil;
if (mvpUser.nickname.length > 0) {
nickname = mvpUser.nickname;
} else if (mvpUser.uid.length > 0) {
nickname = mvpUser.uid;
} else if (![NSString isNull:mvpUserId]) {
nickname = mvpUserId;
}
FUSLiveShowTimeMVPConfirmPopView *popView = [FUSLiveShowTimeMVPConfirmPopView fus_showOnView:containerView];
[popView fus_updateTicketCount:safeFinalTicketNum];
[popView fus_updateAvatarURL:avatarURL nickname:nickname tagText:@"MVP"];
});
} failure:^(NSString * _Nonnull msg, NSInteger code) {
}];
}
/// 展示“票的贡献”弹窗,并拉取贡献列表数据
......@@ -345,6 +419,7 @@
if (dataType == 9999) {
dispatch_async(dispatch_get_main_queue(), ^{
[self fus_destroyShowTimeFrostedIfNeeded];
[self fus_restoreBottomToolButtonsAfterShowTimeIfNeeded];
});
return;
}
......@@ -374,7 +449,15 @@
NSInteger previousFinalTicketNum = self.showTimeLastFinalTicketNum;
NSString *incomingRoundId = (model.stageData.roundId.length > 0 ? model.stageData.roundId : model.roundId);
self.showTimeRoundId = (incomingRoundId.length > 0 ? incomingRoundId : @"");
if (previousRoundId.length > 0 && ![previousRoundId isEqualToString:self.showTimeRoundId]) {
self.showTimeShowEndRequestedRoundId = @"";
}
NSInteger stageStatus = (model.stageData ? model.stageData.showStatus : model.showStatus);
if (stageStatus == 9999) {
[self fus_destroyShowTimeFrostedIfNeeded];
[self fus_restoreBottomToolButtonsAfterShowTimeIfNeeded];
return;
}
self.showTimeStageStatus = stageStatus;
if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAnchor) {
......@@ -412,20 +495,11 @@
cancelSelf.showTimeRoundId = @"";
cancelSelf.showTimeLastFinalTicketNum = -1;
cancelSelf.showTimeStageStatus = -1;
cancelSelf.showTimeShowEndRequestedRoundId = @"";
cancelSelf.showTimeReadyShowStartRequestedRoundId = @"";
cancelSelf.isRequestingShowTimeReadyShowStart = NO;
cancelSelf.showTimeAnchorPopupRemainingSeconds = -1;
if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAnchor) {
FUSLiveBottomToolView *bottomToolView = [cancelSelf fus_currentBottomToolView];
if (bottomToolView) {
BOOL hasTool2 = !CGRectEqualToRect([bottomToolView fus_getBtnFrameWithToolType:FUSLiveBottomToolTypeTool2], CGRectZero);
if (!hasTool2) {
[bottomToolView fus_insertBtnWithType:FUSLiveBottomToolTypeTool2 index:2];
}
[bottomToolView fus_updateRoomScoreType];
}
}
[cancelSelf fus_restoreBottomToolButtonsAfterShowTimeIfNeeded];
// 取消成功后弹出磨砂卡片,展示最终集票数
UIView *onView = [[FUSLiveHelper shareInstance].currentFunctionView fus_viewWithLayer:FUSLiveFunctionLayerManualPopView];
......@@ -988,6 +1062,24 @@
return nil;
}
- (void)fus_restoreBottomToolButtonsAfterShowTimeIfNeeded {
if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAnchor) {
return;
}
FUSLiveBottomToolView *bottomToolView = [self fus_currentBottomToolView];
if (!bottomToolView) {
return;
}
if (self.showTimeDidRemoveTool2) {
BOOL hasTool2 = !CGRectEqualToRect([bottomToolView fus_getBtnFrameWithToolType:FUSLiveBottomToolTypeTool2], CGRectZero);
if (!hasTool2) {
[bottomToolView fus_insertBtnWithType:FUSLiveBottomToolTypeTool2 index:2];
}
self.showTimeDidRemoveTool2 = NO;
}
[bottomToolView fus_updateRoomScoreType];
}
- (NSString *)fus_toastTextForBlockingRoomScopeSetting {
if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAnchor) {
return nil;
......@@ -1111,6 +1203,7 @@
if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAnchor && weakBottomToolView) {
[weakBottomToolView fus_removeBtnWithType:FUSLiveBottomToolTypeTool2];
innerSelf.showTimeDidRemoveTool2 = YES;
UIImage *ticketImage = [FUSShowRoomCenterBunble imageNamed:@"Live_bottom_ticket"];
if (ticketImage) {
[weakBottomToolView fus_updateBtnImageWithType:FUSLiveBottomToolTypeRoomScope image:ticketImage state:UIControlStateNormal];
......@@ -1122,6 +1215,7 @@
innerSelf.showTimeFrostedView = bar;
innerSelf.showTimeRoundId = model.stageData.roundId ?: @"";
innerSelf.showTimeStageStatus = (model.stageData ? model.stageData.showStatus : model.showStatus);
innerSelf.showTimeShowEndRequestedRoundId = @"";
[innerSelf fus_bindShowTimeFrostedAvatarTapHandlerIfNeeded:bar];
__weak typeof(innerSelf) weakInnerSelf = innerSelf;
......@@ -1142,12 +1236,8 @@
[cancelSelf fus_destroyShowTimeFrostedIfNeeded];
cancelSelf.showTimeRoundId = @"";
cancelSelf.showTimeStageStatus = -1;
if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAnchor && weakBottomToolView) {
if (tool2ExistedBeforeStart) {
[weakBottomToolView fus_insertBtnWithType:FUSLiveBottomToolTypeTool2 index:2];
}
[weakBottomToolView fus_updateRoomScoreType];
}
cancelSelf.showTimeDidRemoveTool2 = tool2ExistedBeforeStart;
[cancelSelf fus_restoreBottomToolButtonsAfterShowTimeIfNeeded];
// 取消成功后弹出磨砂卡片,展示最终集票数
UIView *onView = [[FUSLiveHelper shareInstance].currentFunctionView fus_viewWithLayer:FUSLiveFunctionLayerManualPopView];
......@@ -1574,6 +1664,7 @@
NSString *incomingRoundId = (model.stageData.roundId.length > 0 ? model.stageData.roundId : model.roundId);
strongSelf.showTimeRoundId = (incomingRoundId.length > 0 ? incomingRoundId : @"");
strongSelf.showTimeShowEndRequestedRoundId = @"";
NSInteger target = MAX(0, model.targetTicketNum);
NSInteger finalNum = MAX(0, model.finalTicketNum);
......@@ -1805,10 +1896,13 @@
strongSelf.showTimeCountdownRemainSeconds = -1;
strongSelf.showTimeTargetTicketNum = -1;
strongSelf.showTimeStageStatus = -1;
strongSelf.showTimeShowEndRequestedRoundId = @"";
strongSelf.showTimeDidRemoveTool2 = YES;
strongSelf.showTimeMvpNeedTicketCount = -1;
strongSelf.showTimeReadyShowStartRequestedRoundId = @"";
strongSelf.isRequestingShowTimeReadyShowStart = NO;
strongSelf.showTimeAnchorPopupRemainingSeconds = -1;
[strongSelf fus_restoreBottomToolButtonsAfterShowTimeIfNeeded];
});
} failure:^(NSString * _Nonnull msg, NSInteger code) {
dispatch_async(dispatch_get_main_queue(), ^{
......
......@@ -74,7 +74,9 @@ typedef NS_ENUM(NSInteger, FUSLiveShowTimeCollectFrostedAvatarTapType) {
newTicketCount:(NSInteger)newTicketCount
giftUserModel:(FUSOnlineUserModel * _Nullable)giftUserModel
mvpUserModel:(FUSOnlineUserModel * _Nullable)mvpUserModel;
/// 更新顶部赠票用户信息(新票贡献时调用)
/// @param giftUserModel 赠票用户信息
/// @param newTicketCount 新票数
- (void)fus_updateTopTicketInfoWithGiftUserModel:(FUSOnlineUserModel * _Nullable)giftUserModel
newTicketCount:(NSInteger)newTicketCount;
......@@ -96,6 +98,9 @@ typedef NS_ENUM(NSInteger, FUSLiveShowTimeCollectFrostedAvatarTapType) {
/// 点击顶部头像回调(抛到外层处理:如展示“票的贡献”弹窗)
@property (nonatomic, copy, nullable) void (^avatarTapHandler)(FUSLiveShowTimeCollectFrostedAvatarTapType tapType);
/// 表演倒计时结束回调(仅 stageStatus=2 且倒计时归零时触发)
@property (nonatomic, copy, nullable) void (^performanceCountdownEndHandler)(void);
/// 移除磨砂条
- (void)fus_dismiss;
......
......@@ -9,7 +9,7 @@
#import "FUSOnlineUserModel.h"
static const CGFloat kFUSShowTimeFrostedHeight = 120.0;
static const NSInteger kFUSShowTimeCollectSeconds = 10 * 60;
static const NSInteger kFUSShowTimeCollectSeconds = 60;
@interface FUSShowTimePaddingLabel : UILabel
@property (nonatomic, assign) UIEdgeInsets textInsets;
......@@ -100,6 +100,9 @@ static const NSInteger kFUSShowTimeCollectSeconds = 10 * 60;
/// 倒计时刷新计时器
@property (nonatomic, strong) dispatch_source_t countdownTimer;
/// 标记倒计时归零事件是否已回调,避免重复触发
@property (nonatomic, assign) BOOL didNotifyPerformanceCountdownEnd;
@end
@implementation FUSLiveShowTimeCollectFrostedView
......@@ -654,6 +657,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 10 * 60;
- (void)setStageStatus:(NSInteger)stageStatus {
_stageStatus = stageStatus;
self.didNotifyPerformanceCountdownEnd = NO;
self.statusTagLabel.text = @"";
self.statusTagLabel.hidden = YES;
[self fus_applyBottomInfoLayout];
......@@ -710,6 +714,12 @@ static const NSInteger kFUSShowTimeCollectSeconds = 10 * 60;
if (remain <= 0) {
self.countdownLabel.text = @"00:00";
[self fus_stopCountdownTimer];
if (self.stageStatus == 2 && !self.didNotifyPerformanceCountdownEnd) {
self.didNotifyPerformanceCountdownEnd = YES;
if (self.performanceCountdownEndHandler) {
self.performanceCountdownEndHandler();
}
}
return;
}
......
......@@ -2,13 +2,15 @@
NS_ASSUME_NONNULL_BEGIN
/// 底部确认弹窗:展示 MVP 头像/标识/昵称,仅“确认”可关闭
/// 确认弹窗:展示“表演结束”/本场票数/MVP 信息,仅“确认”可关闭
@interface FUSLiveShowTimeMVPConfirmPopView : UIView
/// 展示到指定父视图(存在则复用)
+ (instancetype)fus_showOnView:(UIView *)onView;
/// 更新头像/昵称/MVP 标签文案
- (void)fus_updateAvatarURL:(nullable NSString *)url nickname:(nullable NSString *)nickname tagText:(nullable NSString *)tagText;
/// 更新“本场票数”
- (void)fus_updateTicketCount:(NSInteger)ticketCount;
/// 设置确认按钮点击回调
- (void)fus_setConfirmHandler:(void (^)(void))confirmHandler;
/// 主动关闭弹窗
......
......@@ -9,13 +9,19 @@ static const NSInteger kFUSLiveShowTimeMVPConfirmPopViewTag = 8817401;
/// 背景遮罩按钮(拦截点击,空白区域不关闭)
@property (nonatomic, strong) UIButton *bgBtn;
/// 底部内容容器(白底圆角)
/// 内容容器(白底圆角)
@property (nonatomic, strong) UIView *contentView;
/// 内容容器底约束(控制上/下滑动画)
@property (nonatomic, strong) MASConstraint *contentBottomConstraint;
/// 头部占位视图(用于头像悬停效果)
@property (nonatomic, strong) UIView *headerHolderView;
/// 内容容器的中心Y约束(控制入场/退场动画)
@property (nonatomic, strong) MASConstraint *contentCenterYConstraint;
/// 标题灰色背景(高度 45)
@property (nonatomic, strong) UIView *titleBgView;
/// 标题:表演结束
@property (nonatomic, strong) UILabel *titleLabel;
/// 小标题:本场票数
@property (nonatomic, strong) UILabel *subtitleLabel;
/// 票数值
@property (nonatomic, strong) UILabel *ticketCountLabel;
/// MVP 头像
@property (nonatomic, strong) UIImageView *avatarView;
/// MVP 标识标签
......@@ -29,6 +35,8 @@ static const NSInteger kFUSLiveShowTimeMVPConfirmPopViewTag = 8817401;
/// 确认回调
@property (nonatomic, copy) void (^confirmHandler)(void);
@property (nonatomic, assign) BOOL didAnimateIn;
@end
@implementation FUSLiveShowTimeMVPConfirmPopView
......@@ -54,45 +62,63 @@ static const NSInteger kFUSLiveShowTimeMVPConfirmPopViewTag = 8817401;
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (!self) return nil;
self.didAnimateIn = NO;
self.bgBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.bgBtn.backgroundColor = [UIColor colorWithWhite:0 alpha:0.35];
[self addSubview:self.bgBtn];
CGFloat safeBottom = UIView.fus_SafeBottom;
CGFloat contentH = MIN(300, UIView.fus_screenH * 0.45) + safeBottom;
self.contentView = [[UIView alloc] init];
self.contentView.backgroundColor = UIColor.whiteColor;
self.contentView.layer.cornerRadius = 16;
self.contentView.layer.cornerRadius = 12;
self.contentView.layer.masksToBounds = YES;
if (@available(iOS 11.0, *)) {
self.contentView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
}
[self addSubview:self.contentView];
self.headerHolderView = [[UIView alloc] init];
[self.contentView addSubview:self.headerHolderView];
self.titleBgView = [[UIView alloc] init];
self.titleBgView.backgroundColor = [UIColor colorWithHex:@"#F2F2F2"];
[self.contentView addSubview:self.titleBgView];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.font = [UIFont fus_themeBoldFont:18];
self.titleLabel.textColor = [UIColor colorWithHex:@"#333333"];
self.titleLabel.text = [NSString fus_localString:@"表演结束"];
[self.titleBgView addSubview:self.titleLabel];
self.subtitleLabel = [[UILabel alloc] init];
self.subtitleLabel.textAlignment = NSTextAlignmentCenter;
self.subtitleLabel.font = [UIFont fus_themeFont:15];
self.subtitleLabel.textColor = [UIColor colorWithHex:@"#9AA0A6"];
self.subtitleLabel.text = [NSString fus_localString:@"本场票数"];
[self.contentView addSubview:self.subtitleLabel];
self.ticketCountLabel = [[UILabel alloc] init];
self.ticketCountLabel.textAlignment = NSTextAlignmentCenter;
self.ticketCountLabel.font = [UIFont fus_themeBoldFont:44];
self.ticketCountLabel.textColor = [UIColor colorWithHex:@"#01D9E0"];
self.ticketCountLabel.text = @"--";
[self.contentView addSubview:self.ticketCountLabel];
self.avatarView = [[UIImageView alloc] init];
self.avatarView.layer.cornerRadius = 28;
self.avatarView.layer.cornerRadius = 25;
self.avatarView.layer.masksToBounds = YES;
self.avatarView.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1];
[self addSubview:self.avatarView];
self.avatarView.image = [UIImage fus_defaultIcon];
[self.contentView addSubview:self.avatarView];
self.mvpTagLabel = [[UILabel alloc] init];
self.mvpTagLabel.text = @"MVP";
self.mvpTagLabel.textAlignment = NSTextAlignmentCenter;
self.mvpTagLabel.font = [UIFont fus_themeBoldFont:12];
self.mvpTagLabel.textColor = UIColor.blackColor;
self.mvpTagLabel.backgroundColor = [UIColor colorWithHex:@"#52DDE2"];
self.mvpTagLabel.backgroundColor = [UIColor colorWithHex:@"#01D9E0"];
self.mvpTagLabel.layer.cornerRadius = 10;
self.mvpTagLabel.layer.masksToBounds = YES;
[self.contentView addSubview:self.mvpTagLabel];
self.nicknameLabel = [[UILabel alloc] init];
self.nicknameLabel.textAlignment = NSTextAlignmentCenter;
self.nicknameLabel.font = [UIFont fus_themeBoldFont:16];
self.nicknameLabel.font = [UIFont fus_themeBoldFont:15];
self.nicknameLabel.textColor = [UIColor colorWithHex:@"#333333"];
[self.contentView addSubview:self.nicknameLabel];
......@@ -100,8 +126,8 @@ static const NSInteger kFUSLiveShowTimeMVPConfirmPopViewTag = 8817401;
[self.confirmBtn setTitle:[NSString fus_localString:@"确认"] forState:UIControlStateNormal];
self.confirmBtn.titleLabel.font = [UIFont fus_themeBoldFont:16];
[self.confirmBtn setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
self.confirmBtn.backgroundColor = [UIColor colorWithHex:@"#52DDE2"];
self.confirmBtn.layer.cornerRadius = 24;
self.confirmBtn.backgroundColor = [UIColor colorWithHex:@"#01D9E0"];
self.confirmBtn.layer.cornerRadius = 22;
self.confirmBtn.layer.masksToBounds = YES;
[self.confirmBtn addTarget:self action:@selector(onConfirm) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:self.confirmBtn];
......@@ -110,46 +136,80 @@ static const NSInteger kFUSLiveShowTimeMVPConfirmPopViewTag = 8817401;
make.edges.equalTo(self);
}];
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.height.mas_equalTo(contentH);
self.contentBottomConstraint = make.bottom.equalTo(self).offset(contentH);
make.centerX.equalTo(self);
self.contentCenterYConstraint = make.centerY.equalTo(self).offset(UIView.fus_screenH);
make.width.equalTo(@295).priorityHigh();
make.left.greaterThanOrEqualTo(self).offset(40);
make.right.lessThanOrEqualTo(self).offset(-40);
make.height.mas_equalTo(290);
}];
[self.titleBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.equalTo(self.contentView);
make.height.mas_equalTo(45);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.titleBgView);
}];
[self.subtitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.titleBgView.mas_bottom).offset(16);
make.left.equalTo(self.contentView).offset(16);
make.right.equalTo(self.contentView).offset(-16);
make.height.mas_equalTo(16);
}];
[self.headerHolderView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.contentView);
make.top.equalTo(self.contentView);
make.height.mas_equalTo(48);
[self.ticketCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.subtitleLabel.mas_bottom).offset(2);
make.left.right.equalTo(self.subtitleLabel);
make.height.mas_equalTo(52);
}];
[self.avatarView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.centerY.equalTo(self.contentView.mas_top).offset(0);
make.size.mas_equalTo(CGSizeMake(56, 56));
make.top.equalTo(self.ticketCountLabel.mas_bottom).offset(8);
make.size.mas_equalTo(CGSizeMake(50, 50));
}];
[self.mvpTagLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.top.equalTo(self.headerHolderView.mas_bottom).offset(16);
make.centerX.equalTo(self.avatarView);
make.top.equalTo(self.avatarView.mas_bottom).offset(-8);
make.size.mas_equalTo(CGSizeMake(54, 20));
}];
[self.nicknameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(16);
make.right.equalTo(self.contentView).offset(-16);
make.top.equalTo(self.mvpTagLabel.mas_bottom).offset(8);
make.height.mas_equalTo(22);
make.top.equalTo(self.mvpTagLabel.mas_bottom).offset(6);
make.height.mas_equalTo(20);
}];
[self.confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(24);
make.right.equalTo(self.contentView).offset(-24);
make.height.mas_equalTo(48);
make.bottom.equalTo(self.contentView).offset(-(safeBottom + 16));
make.height.mas_equalTo(44);
make.bottom.equalTo(self.contentView).offset(-18);
}];
return self;
}
- (void)didMoveToSuperview {
[super didMoveToSuperview];
if (!self.superview || self.didAnimateIn) {
return;
}
self.didAnimateIn = YES;
self.alpha = 0;
[self.superview layoutIfNeeded];
[self.contentCenterYConstraint setOffset:0];
[UIView animateWithDuration:0.25 animations:^{
self.alpha = 1;
[self.superview layoutIfNeeded];
}];
}
/// 点击确认:回调并关闭弹窗
- (void)onConfirm {
if (self.confirmHandler) {
......@@ -167,6 +227,11 @@ static const NSInteger kFUSLiveShowTimeMVPConfirmPopViewTag = 8817401;
self.mvpTagLabel.text = (tagText.length > 0 ? tagText : @"MVP");
}
- (void)fus_updateTicketCount:(NSInteger)ticketCount {
NSInteger safeCount = MAX(0, ticketCount);
self.ticketCountLabel.text = [NSString stringWithFormat:@"%zd", (NSInteger)safeCount];
}
/// 设置确认按钮回调
- (void)fus_setConfirmHandler:(void (^)(void))confirmHandler {
self.confirmHandler = [confirmHandler copy];
......@@ -174,11 +239,10 @@ static const NSInteger kFUSLiveShowTimeMVPConfirmPopViewTag = 8817401;
/// 关闭弹窗:下滑动画后移除
- (void)fus_dismiss {
CGFloat safeBottom = UIView.fus_SafeBottom;
CGFloat contentH = MIN(300, UIView.fus_screenH * 0.45) + safeBottom;
[self.contentBottomConstraint setOffset:contentH];
[self.contentCenterYConstraint setOffset:UIView.fus_screenH];
[UIView animateWithDuration:0.25 animations:^{
[self layoutIfNeeded];
self.alpha = 0;
[self.superview layoutIfNeeded];
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
......
......@@ -596,6 +596,9 @@ NS_ASSUME_NONNULL_BEGIN
/// Ticket Show - 功能 - 主播端开始/取消表演
+ (NSString *)fus_URL_TicketShow_Show_Toggle;
/// Ticket Show - 功能 - 主播端表演结束
+ (NSString *)fus_URL_TicketShow_Show_End;
/// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新)
+ (NSString *)fus_URL_TicketShow_Progress_GetInfo;
......
......@@ -982,6 +982,12 @@
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/ticketshow/show/toggle"];
}
/// Ticket Show - 功能 - 主播端表演结束
+ (NSString *)fus_URL_TicketShow_Show_End
{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/ticketshow/show/end"];
}
/// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新)
+ (NSString *)fus_URL_TicketShow_Progress_GetInfo
{
......
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