Commit 75fc8c51 by suolong

开始表演表演api

parent 654c3e0e
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
00F7FF722FAF000100AAAA1B /* FUSLiveShowTimeTicketContributionPopView.h in Headers */ = {isa = PBXBuildFile; fileRef = 00F7FF702FAF000100AAAA19 /* FUSLiveShowTimeTicketContributionPopView.h */; };
00F7FF732FAF000100AAAA1C /* FUSLiveShowTimeTicketContributionPopView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00F7FF712FAF000100AAAA1A /* FUSLiveShowTimeTicketContributionPopView.m */; };
004772D72F5AE86A00E46A79 /* PK_Cover_Animation_8.png in Resources */ = {isa = PBXBuildFile; fileRef = 004772B62F5AE86A00E46A79 /* PK_Cover_Animation_8.png */; }; 004772D72F5AE86A00E46A79 /* PK_Cover_Animation_8.png in Resources */ = {isa = PBXBuildFile; fileRef = 004772B62F5AE86A00E46A79 /* PK_Cover_Animation_8.png */; };
004772D82F5AE86A00E46A79 /* PK_Cover_Animation_29.png in Resources */ = {isa = PBXBuildFile; fileRef = 004772CB2F5AE86A00E46A79 /* PK_Cover_Animation_29.png */; }; 004772D82F5AE86A00E46A79 /* PK_Cover_Animation_29.png in Resources */ = {isa = PBXBuildFile; fileRef = 004772CB2F5AE86A00E46A79 /* PK_Cover_Animation_29.png */; };
004772D92F5AE86A00E46A79 /* PK_Cover_Animation_20.png in Resources */ = {isa = PBXBuildFile; fileRef = 004772C22F5AE86A00E46A79 /* PK_Cover_Animation_20.png */; }; 004772D92F5AE86A00E46A79 /* PK_Cover_Animation_20.png in Resources */ = {isa = PBXBuildFile; fileRef = 004772C22F5AE86A00E46A79 /* PK_Cover_Animation_20.png */; };
...@@ -3884,6 +3886,8 @@ ...@@ -3884,6 +3886,8 @@
00F7FF152F9A100100AAAA06 /* FUSLiveShowTimeTicketContributionListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSLiveShowTimeTicketContributionListView.m; sourceTree = "<group>"; }; 00F7FF152F9A100100AAAA06 /* FUSLiveShowTimeTicketContributionListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSLiveShowTimeTicketContributionListView.m; sourceTree = "<group>"; };
00F7FF162F9A100100AAAA07 /* FUSLiveShowTimeTicketNoticeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSLiveShowTimeTicketNoticeView.h; sourceTree = "<group>"; }; 00F7FF162F9A100100AAAA07 /* FUSLiveShowTimeTicketNoticeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSLiveShowTimeTicketNoticeView.h; sourceTree = "<group>"; };
00F7FF172F9A100100AAAA08 /* FUSLiveShowTimeTicketNoticeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSLiveShowTimeTicketNoticeView.m; sourceTree = "<group>"; }; 00F7FF172F9A100100AAAA08 /* FUSLiveShowTimeTicketNoticeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSLiveShowTimeTicketNoticeView.m; sourceTree = "<group>"; };
00F7FF702FAF000100AAAA19 /* FUSLiveShowTimeTicketContributionPopView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSLiveShowTimeTicketContributionPopView.h; sourceTree = "<group>"; };
00F7FF712FAF000100AAAA1A /* FUSLiveShowTimeTicketContributionPopView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSLiveShowTimeTicketContributionPopView.m; sourceTree = "<group>"; };
BED655F22C5B745D00668116 /* FUSLiveBottomToolView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSLiveBottomToolView.h; sourceTree = "<group>"; }; BED655F22C5B745D00668116 /* FUSLiveBottomToolView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSLiveBottomToolView.h; sourceTree = "<group>"; };
BED655F32C5B745D00668116 /* FUSLiveBottomToolView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSLiveBottomToolView.m; sourceTree = "<group>"; }; BED655F32C5B745D00668116 /* FUSLiveBottomToolView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUSLiveBottomToolView.m; sourceTree = "<group>"; };
BED655F42C5B745D00668116 /* FUSLiveChatFastInputCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSLiveChatFastInputCell.h; sourceTree = "<group>"; }; BED655F42C5B745D00668116 /* FUSLiveChatFastInputCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUSLiveChatFastInputCell.h; sourceTree = "<group>"; };
...@@ -6921,6 +6925,8 @@ ...@@ -6921,6 +6925,8 @@
00E6CB0C2F4D523000B63797 /* FUSLiveGameListViewHeader.swift */, 00E6CB0C2F4D523000B63797 /* FUSLiveGameListViewHeader.swift */,
00E6CE1F2F56F5F200B63797 /* FUSLiveBottomToolWebpButton.swift */, 00E6CE1F2F56F5F200B63797 /* FUSLiveBottomToolWebpButton.swift */,
00F7FF302F9A100100AAAA01 /* FUSLiveShowTimeTicketActionPop */, 00F7FF302F9A100100AAAA01 /* FUSLiveShowTimeTicketActionPop */,
00F7FF702FAF000100AAAA19 /* FUSLiveShowTimeTicketContributionPopView.h */,
00F7FF712FAF000100AAAA1A /* FUSLiveShowTimeTicketContributionPopView.m */,
); );
path = ChatInputView; path = ChatInputView;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -8766,6 +8772,7 @@ ...@@ -8766,6 +8772,7 @@
00F7FF222F9A100100AAAA03 /* FUSLiveShowTimeTicketContributionCell.h in Headers */, 00F7FF222F9A100100AAAA03 /* FUSLiveShowTimeTicketContributionCell.h in Headers */,
00F7FF242F9A100100AAAA05 /* FUSLiveShowTimeTicketContributionListView.h in Headers */, 00F7FF242F9A100100AAAA05 /* FUSLiveShowTimeTicketContributionListView.h in Headers */,
00F7FF262F9A100100AAAA07 /* FUSLiveShowTimeTicketNoticeView.h in Headers */, 00F7FF262F9A100100AAAA07 /* FUSLiveShowTimeTicketNoticeView.h in Headers */,
00F7FF722FAF000100AAAA1B /* FUSLiveShowTimeTicketContributionPopView.h in Headers */,
00B28CBA2D2FC4E10008476B /* FUSLiveEndLiveAssesModel.h in Headers */, 00B28CBA2D2FC4E10008476B /* FUSLiveEndLiveAssesModel.h in Headers */,
BE189DDF2C733B460008418B /* FSRRoomManagerViewController.h in Headers */, BE189DDF2C733B460008418B /* FSRRoomManagerViewController.h in Headers */,
BED65A442C5B745F00668116 /* FUSLiveBoxDetailSettingView.h in Headers */, BED65A442C5B745F00668116 /* FUSLiveBoxDetailSettingView.h in Headers */,
...@@ -10850,6 +10857,7 @@ ...@@ -10850,6 +10857,7 @@
00F7FF232F9A100100AAAA04 /* FUSLiveShowTimeTicketContributionCell.m in Sources */, 00F7FF232F9A100100AAAA04 /* FUSLiveShowTimeTicketContributionCell.m in Sources */,
00F7FF252F9A100100AAAA06 /* FUSLiveShowTimeTicketContributionListView.m in Sources */, 00F7FF252F9A100100AAAA06 /* FUSLiveShowTimeTicketContributionListView.m in Sources */,
00F7FF272F9A100100AAAA08 /* FUSLiveShowTimeTicketNoticeView.m in Sources */, 00F7FF272F9A100100AAAA08 /* FUSLiveShowTimeTicketNoticeView.m in Sources */,
00F7FF732FAF000100AAAA1C /* FUSLiveShowTimeTicketContributionPopView.m in Sources */,
BED6599E2C5B745F00668116 /* FUSLinkMicItemView.m in Sources */, BED6599E2C5B745F00668116 /* FUSLinkMicItemView.m in Sources */,
BED658802C5B745E00668116 /* FUSLivePropsModel.m in Sources */, BED658802C5B745E00668116 /* FUSLivePropsModel.m in Sources */,
BE189DB82C733B460008418B /* FSRRoomManagerShowRoomModel.m in Sources */, BE189DB82C733B460008418B /* FSRRoomManagerShowRoomModel.m in Sources */,
...@@ -55,16 +55,21 @@ typedef NS_ENUM(NSInteger, FUSLiveShowTimeCollectFrostedDisplayMode) { ...@@ -55,16 +55,21 @@ typedef NS_ENUM(NSInteger, FUSLiveShowTimeCollectFrostedDisplayMode) {
mvpUserModel:(FUSOnlineUserModel * _Nullable)mvpUserModel; mvpUserModel:(FUSOnlineUserModel * _Nullable)mvpUserModel;
/// 用户端更新展示内容(用于用户中途进房时同步倒计时) /// 用户端更新展示内容(用于用户中途进房时同步倒计时)
/// @param countdownRemainingSeconds 距离结束剩余秒数;<0 表示未知,内部按 10 分钟从当前开始计时 /// @param countdownTotalSeconds 当前阶段总时长(秒);<=0 表示未知,内部按 10 分钟兜底
/// @param countdownRemainingSeconds 距离结束剩余秒数;<0 表示未知,内部按总时长从当前开始计时
- (void)fus_updateAudienceWithState:(FUSLiveShowTimeCollectFrostedState)state - (void)fus_updateAudienceWithState:(FUSLiveShowTimeCollectFrostedState)state
themeText:(NSString *)themeText themeText:(NSString *)themeText
progress:(CGFloat)progress progress:(CGFloat)progress
remainingText:(NSString *)remainingText remainingText:(NSString *)remainingText
countdownTotalSeconds:(NSInteger)countdownTotalSeconds
countdownRemainingSeconds:(NSInteger)countdownRemainingSeconds countdownRemainingSeconds:(NSInteger)countdownRemainingSeconds
newTicketCount:(NSInteger)newTicketCount newTicketCount:(NSInteger)newTicketCount
giftUserModel:(FUSOnlineUserModel * _Nullable)giftUserModel giftUserModel:(FUSOnlineUserModel * _Nullable)giftUserModel
mvpUserModel:(FUSOnlineUserModel * _Nullable)mvpUserModel; mvpUserModel:(FUSOnlineUserModel * _Nullable)mvpUserModel;
- (void)fus_updateTopTicketInfoWithGiftUserModel:(FUSOnlineUserModel * _Nullable)giftUserModel
newTicketCount:(NSInteger)newTicketCount;
/// 取消按钮点击回调(预留服务端入口) /// 取消按钮点击回调(预留服务端入口)
@property (nonatomic, copy, nullable) void (^cancelHandler)(void); @property (nonatomic, copy, nullable) void (^cancelHandler)(void);
......
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class FUSShowRoomUserContributeModel;
/**
弹窗视图:票的贡献列表底部上滑弹窗
设计目标:
- 与现有底部弹窗交互一致(半透明遮罩、白底圆角、右上角关闭)
- 内部复用既有贡献列表样式与cell,保持一致的排版与风格
使用方式:
- 调用 fus_showOnView: 展示到指定父视图
- 通过 fus_updateTotalCount: 更新标题上的贡献总数
- 通过 fus_updateContributionList: 更新列表数据
- 调用 fus_dismiss 主动关闭
*/
@interface FUSLiveShowTimeTicketContributionPopView : UIView
/// 展示到指定父视图(已做同类弹窗复用处理)
/// - Parameter onView: 作为承载容器的父视图
/// - Returns: 弹窗实例(可能是复用已有实例)
+ (instancetype)fus_showOnView:(UIView *)onView;
/// 更新标题右侧的贡献总数展示(当 totalCount <= 0 时只显示“票的贡献”)
/// - Parameter totalCount: 贡献总数
- (void)fus_updateTotalCount:(NSInteger)totalCount;
/// 更新列表数据(内部复用现有 FUSLiveShowTimeTicketContributionListView)
/// - Parameter contributionList: 贡献用户数据列表
- (void)fus_updateContributionList:(NSArray<FUSShowRoomUserContributeModel *> *)contributionList;
/// 关闭弹窗(含下滑动画与移除)
- (void)fus_dismiss;
@end
NS_ASSUME_NONNULL_END
#import "FUSLiveShowTimeTicketContributionPopView.h"
#import <Masonry/Masonry.h>
#import <FUSCommon/FUSCommon.h>
#import <FUSFoundation/FUSFoundation.h>
#import "FUSShowRoomCenterBunble.h"
#import "FUSLiveShowTimeTicketContributionListView.h"
static const NSInteger kFUSShowTimeTicketContributionPopViewTag = 8817316;
@interface FUSLiveShowTimeTicketContributionPopView ()
/// 背景遮罩按钮(点击关闭)
@property (nonatomic, strong) UIButton *bgBtn;
/// 底部内容容器(白底圆角)
@property (nonatomic, strong) UIView *contentView;
/// 内容容器底约束(用于控制上/下滑动画)
@property (nonatomic, strong) MASConstraint *contentBottomConstraint;
/// 标题标签(显示“票的贡献”与总数)
@property (nonatomic, strong) UILabel *titleLabel;
/// 关闭按钮(右上角 X)
@property (nonatomic, strong) UIButton *closeBtn;
/// 顶部分割线(标题与列表的分隔)
@property (nonatomic, strong) UIView *headerDividerView;
/// 贡献列表视图(复用既有列表与cell)
@property (nonatomic, strong) FUSLiveShowTimeTicketContributionListView *listView;
/// 当前总贡献数(用于标题文案)
@property (nonatomic, assign) NSInteger totalCount;
@end
@implementation FUSLiveShowTimeTicketContributionPopView
+ (instancetype)fus_showOnView:(UIView *)onView {
if (!onView) {
return nil;
}
FUSLiveShowTimeTicketContributionPopView *existView = [onView viewWithTag:kFUSShowTimeTicketContributionPopViewTag];
if ([existView isKindOfClass:FUSLiveShowTimeTicketContributionPopView.class]) {
[onView bringSubviewToFront:existView];
[existView fus_show];
return existView;
}
FUSLiveShowTimeTicketContributionPopView *view = [[FUSLiveShowTimeTicketContributionPopView alloc] initWithFrame:CGRectZero];
view.tag = kFUSShowTimeTicketContributionPopViewTag;
[onView addSubview:view];
[view mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(onView);
}];
[view fus_show];
return view;
}
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (!self) {
return nil;
}
self.totalCount = 0;
// 遮罩与点击关闭
self.bgBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.bgBtn.backgroundColor = [UIColor colorWithWhite:0 alpha:0.35];
[self.bgBtn addTarget:self action:@selector(fus_dismiss) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:self.bgBtn];
// 计算内容高度:最大 520 或屏高 * 0.85,再加安全区底部
CGFloat safeBottom = UIView.fus_SafeBottom;
CGFloat maxContentH = MIN(520, UIView.fus_screenH * 0.85);
CGFloat contentH = maxContentH + safeBottom;
// 底部内容容器:白底、仅顶部圆角,保持与全局弹窗一致
self.contentView = [[UIView alloc] initWithFrame:CGRectZero];
self.contentView.backgroundColor = UIColor.whiteColor;
self.contentView.layer.cornerRadius = 16;
self.contentView.layer.masksToBounds = YES;
if (@available(iOS 11.0, *)) {
self.contentView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
}
[self addSubview:self.contentView];
// 标题与关闭按钮
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
self.titleLabel.font = [UIFont fus_themeBoldFont:16];
self.titleLabel.textColor = [UIColor colorWithHex:@"#333333"];
self.titleLabel.text = [NSString fus_localString:@"票的贡献"];
[self.contentView addSubview:self.titleLabel];
self.closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self.closeBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_board_close"] forState:UIControlStateNormal];
[self.closeBtn addTarget:self action:@selector(fus_dismiss) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:self.closeBtn];
// 顶部分割线
self.headerDividerView = [[UIView alloc] initWithFrame:CGRectZero];
self.headerDividerView.backgroundColor = [UIColor colorWithHex:@"#F2F3F5"];
[self.contentView addSubview:self.headerDividerView];
// 列表(复用现有 ListView 与 Cell,确保样式一致)
self.listView = [[FUSLiveShowTimeTicketContributionListView alloc] initWithFrame:CGRectZero];
[self.contentView addSubview:self.listView];
// Masonry 约束:遮罩覆盖全屏
[self.bgBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
// Masonry 约束:内容容器初始位于屏幕下方,通过 bottom 约束控制动画
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.height.mas_equalTo(contentH);
self.contentBottomConstraint = make.bottom.equalTo(self).offset(contentH);
}];
// Masonry 约束:右上角关闭按钮固定 44x44,标题居中对齐关闭按钮
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView);
make.top.equalTo(self.contentView);
make.width.height.mas_equalTo(44);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(16);
make.centerY.equalTo(self.closeBtn);
make.right.lessThanOrEqualTo(self.closeBtn.mas_left).offset(-8);
make.height.mas_equalTo(22);
}];
// Masonry 约束:分割线位于标题下方
[self.headerDividerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.contentView);
make.top.equalTo(self.closeBtn.mas_bottom);
make.height.mas_equalTo(0.5);
}];
// Masonry 约束:列表填充剩余区域,底部让出安全区
[self.listView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.contentView);
make.top.equalTo(self.headerDividerView.mas_bottom);
make.bottom.equalTo(self.contentView).offset(-safeBottom);
}];
return self;
}
- (void)fus_updateTotalCount:(NSInteger)totalCount {
self.totalCount = MAX(0, totalCount);
if (self.totalCount > 0) {
self.titleLabel.text = [NSString stringWithFormat:@"%@ %zd", [NSString fus_localString:@"票的贡献"], (NSInteger)self.totalCount];
} else {
self.titleLabel.text = [NSString fus_localString:@"票的贡献"];
}
}
- (void)fus_updateContributionList:(NSArray<FUSShowRoomUserContributeModel *> *)contributionList {
self.listView.contributionList = (contributionList ?: @[]);
}
- (void)fus_show {
// 上滑动画:将 bottom 约束置 0,使内容容器进入可视区域
[self.superview layoutIfNeeded];
[self.contentBottomConstraint setOffset:0];
[UIView animateWithDuration:0.3 animations:^{
[self.superview layoutIfNeeded];
}];
}
- (void)fus_dismiss {
// 下滑动画:恢复初始 bottom 偏移,结束后移除
CGFloat safeBottom = UIView.fus_SafeBottom;
CGFloat maxContentH = MIN(520, UIView.fus_screenH * 0.85);
CGFloat contentH = maxContentH + safeBottom;
[self.contentBottomConstraint setOffset:contentH];
[UIView animateWithDuration:0.25 animations:^{
self.bgBtn.alpha = 0;
[self layoutIfNeeded];
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
@end
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