Commit 96373ac8 by suolong

提交bug

parent 76cce0cc
Showing with 257 additions and 77 deletions
......@@ -3438,7 +3438,7 @@
"试看%ldS" = "试看%ldS";
"您可陪伴%ld分钟,%ld/分钟" = "您可陪伴%ld分钟,%ld/分钟";
"您可陪伴%ld分钟,%ld/分钟" = "您可陪伴%ld分钟,%ld/分钟";
"%ld/分钟" = "%ld 分钟";
......@@ -3476,7 +3476,7 @@
"互动内容" = "互动内容";
"新增表演" = "新增表演";
"添加表演" = "添加表演";
"礼物互动" = "礼物互动";
......
......@@ -3438,7 +3438,7 @@
"试看%ldS" = "試看%ldS";
"您可陪伴%ld分钟,%ld/分钟" = "您可陪伴%ld分鐘,%ld/分鐘";
"您可陪伴%ld分钟,%ld/分钟" = "您可陪伴%ld分鐘,%ld/分鐘";
"%ld/分钟" = "%ld/分鐘";
......@@ -3476,7 +3476,7 @@
"互动内容" = "互動內容";
"新增表演" = "新增表演";
"添加表演" = "添加表演";
"礼物互动" = "禮物互動";
......
......@@ -3438,7 +3438,7 @@
"试看%ldS" = "Previewing %ldS";
"您可陪伴%ld分钟,%ld/分钟" = "You can accompany for %ld minutes, %ld/minute";
"您可陪伴%ld分钟,%ld/分钟" = "You can accompany for %ld minutes,%ld/minute";
"%ld/分钟" = "%ld minutes";
......@@ -3476,7 +3476,7 @@
"互动内容" = "Interactive Content";
"新增表演" = "New Performance";
"添加表演" = "Add Performance";
"礼物互动" = "Gift Interaction";
......@@ -3592,7 +3592,7 @@
"试看中:" = "Previewing:";
"%zd人正在陪伴" = "Number of {0} accompanying";
"%zd人正在陪伴" = "Number of %zd accompanying";
"下次计费" = "Next billing";
......
......@@ -3416,7 +3416,7 @@
"试看%ldS" = "試聴%ldS";
"您可陪伴%ld分钟,%ld/分钟" = "ご一緒できる時間は%ld分、%ld/分です";
"您可陪伴%ld分钟,%ld/分钟" = "ご一緒できる時間は%ld分,%ld/分です";
"%ld/分钟" = "%ld 分";
......@@ -3454,7 +3454,7 @@
"互动内容" = "インタラクティブコンテンツ";
"新增表演" = "新たなパフォーマンス";
"添加表演" = "パフォーマンスを追加";
"礼物互动" = "ギフトインタラクション";
......@@ -3570,7 +3570,7 @@
"试看中:" = "中国語で試してみてください:";
"%zd人正在陪伴" = "数 {0} 人がお見守り中";
"%zd人正在陪伴" = "数 %zd 人がお見守り中";
"下次计费" = "次回の課金";
......
......@@ -3410,7 +3410,7 @@
"试看%ldS" = "ทดสอบดู %ldS";
"您可陪伴%ld分钟%ld/分钟" = "คุณสามารถแบ่งปันเวลาได้ %ld นาที รายนาที %ld";
"您可陪伴%ld分钟,%ld/分钟" = "คุณสามารถแบ่งปันเวลาได้ %ld นาที รายนาที %ld";
"%ld/分钟" = "%ld นาที";
......@@ -3448,7 +3448,7 @@
"互动内容" = "เนื้อหาปฏิสนธ์";
"新增表演" = "การเพิ่มการแสดง";
"添加表演" = "إضافة أداء";
"礼物互动" = "ปฏิกิริยาของของขวัญ";
......@@ -3564,7 +3564,7 @@
"试看中:" = "ทดลองชมภาษาจีน:";
"%zd人正在陪伴" = "จำนวน {0} คนที่เข้าร่วม";
"%zd人正在陪伴" = "จำนวน %zd คนที่เข้าร่วม";
"下次计费" = "ครั้งถัดไปในการเรียกเก็บค่าบริการ";
......
......@@ -3416,7 +3416,7 @@
"试看%ldS" = "Thử xem %ldS";
"您可陪伴%ld分钟%ld/分钟" = "Bạn có thể đồng hành trong %ld phút, %ld/phút";
"您可陪伴%ld分钟,%ld/分钟" = "Bạn có thể đồng hành trong %ld phút, %ld/phút";
"%ld/分钟" = "%ld phút";
......@@ -3454,7 +3454,7 @@
"互动内容" = "Nội dung tương tác";
"新增表演" = "Thêm biểu diễn";
"添加表演" = "Thêm biểu diễn";
"礼物互动" = "Hoạt động quà tặng";
......@@ -3570,7 +3570,7 @@
"试看中:" = "Thử xem tiếng Trung:";
"%zd人正在陪伴" = "Số {0} người tham gia";
"%zd人正在陪伴" = "Số %zd người tham gia";
"下次计费" = "Lần tiếp theo tính phí";
......
......@@ -691,7 +691,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 202506260059;
CURRENT_PROJECT_VERSION = 202506260061;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO;
......@@ -956,7 +956,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 202506260059;
CURRENT_PROJECT_VERSION = 202506260061;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO;
......
{
"images" : [
{
"filename" : "live_push_live_time_bg_pay_scope.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -9,6 +9,7 @@
#import "FUSLiveGiftInteractOptionModel.h"
#import "FUSLiveHelper.h"
#import "FUSLiveHttpHelper.h"
#import <Masonry/Masonry.h>
static NSInteger const FUSLiveGiftInteractMaxItemCount = 20;
......@@ -273,19 +274,16 @@ static NSInteger const FUSLiveGiftInteractMaxItemCount = 20;
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 44)];
header.backgroundColor = UIColor.whiteColor;
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(16, 0, header.bounds.size.width - 16 - 16 - 120, 44)];
label.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
label.font = [UIFont fus_themeFont:14];
label.textColor = [UIColor colorWithHex:@"#999999"];
label.text = [NSString stringWithFormat:@"%@(%ld/%ld)", [NSString fus_localString:@"互动内容"], (long)self.items.count, (long)FUSLiveGiftInteractMaxItemCount];
[header addSubview:label];
UIButton *addBtn = [UIButton buttonWithType:UIButtonTypeCustom];
addBtn.frame = CGRectMake(header.bounds.size.width - 16 - 108, 8, 108, 28);
addBtn.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
addBtn.titleLabel.font = [UIFont fus_themeFont:12];
[addBtn setTitleColor:[UIColor colorWithHex:@"#22222B"] forState:UIControlStateNormal];
[addBtn setTitle:[NSString fus_localString:@"新增表演"] forState:UIControlStateNormal];
[addBtn setTitle:[NSString fus_localString:@"添加表演"] forState:UIControlStateNormal];
[addBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"Live_bottom_addAct"] forState:UIControlStateNormal];
addBtn.backgroundColor = [UIColor colorWithHex:@"#EFEFEF"];
addBtn.layer.cornerRadius = 14;
......@@ -295,6 +293,19 @@ static NSInteger const FUSLiveGiftInteractMaxItemCount = 20;
[addBtn addTarget:self action:@selector(onClickAdd) forControlEvents:UIControlEventTouchUpInside];
[header addSubview:addBtn];
[addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(header).offset(-16);
make.centerY.equalTo(header);
make.height.mas_equalTo(28);
make.width.greaterThanOrEqualTo(@108);
}];
[label mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(header).offset(16);
make.centerY.equalTo(header);
make.right.lessThanOrEqualTo(addBtn.mas_left).offset(-12);
}];
return header;
}
......
......@@ -1387,7 +1387,7 @@ static NSInteger const kFUSPayRoomCompanionPopViewTagLeft = 90917002;
viewModel.trialButtonHidden = (previewTime <= 0);
viewModel.trialButtonTitle = [NSString stringWithFormat:[NSString fus_localString:@"试看%ldS"], (long)previewTime];
viewModel.bottomTipText = ([NSString stringWithFormat:[NSString fus_localString:@"您可陪伴%ld分钟%ld/分钟"], (long)canCompanionTime, (long)pricePerMinute]);
viewModel.bottomTipText = ([NSString stringWithFormat:[NSString fus_localString:@"您可陪伴%ld分钟,%ld/分钟"], (long)canCompanionTime, (long)pricePerMinute]);
return viewModel;
}
......
......@@ -8,8 +8,9 @@
#import "FUSLiveBottomToolView.h"
#import "FUSOnlineUserModel.h"
static const CGFloat kFUSShowTimeFrostedHeight = 120.0;
static const CGFloat kFUSShowTimeFrostedHeight = 130.0;
static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
static const CGFloat kFUSShowTimeTopVipHeight = 14.0;
@interface FUSShowTimePaddingLabel : UILabel
@property (nonatomic, assign) UIEdgeInsets textInsets;
......@@ -158,7 +159,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
[self.blurView.contentView addSubview:self.topTicketInfoContainerView];
self.avatarView = [[UIImageView alloc] init];
self.avatarView.layer.cornerRadius = 11;
self.avatarView.layer.cornerRadius = 14;
self.avatarView.layer.masksToBounds = YES;
self.avatarView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.2];
self.avatarView.userInteractionEnabled = YES;
......@@ -205,7 +206,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
self.lastNewTicketCount = 0;
self.cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.cancelBtn.layer.cornerRadius = 13;
self.cancelBtn.layer.cornerRadius = 17;
self.cancelBtn.layer.masksToBounds = YES;
self.cancelBtn.backgroundColor = [UIColor fus_themeColor];
[self.cancelBtn setTitle:[NSString fus_localString:@"取消集票"] forState:UIControlStateNormal];
......@@ -260,7 +261,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
self.countdownLabel = [[UILabel alloc] init];
self.countdownLabel.font = [UIFont fus_themeFont:12];
self.countdownLabel.textColor = [UIColor colorWithWhite:1 alpha:0.85];
self.countdownLabel.textColor = [UIColor fus_textColorLight2];
self.countdownLabel.textAlignment = NSTextAlignmentLeft;
self.countdownLabel.text = @"";
[self.blurView.contentView addSubview:self.countdownLabel];
......@@ -297,21 +298,21 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
[self.progressContainer mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.blurView.contentView).offset(14);
make.centerY.equalTo(self.bottomContentView);
make.top.equalTo(self.bottomContentView).offset(8);
make.size.mas_equalTo(CGSizeMake(52, 52));
make.top.greaterThanOrEqualTo(self.bottomContentView).offset(8);
}];
[self.topTicketInfoContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.blurView.contentView).offset(12);
make.top.equalTo(self.blurView.contentView).offset(10);
make.height.mas_equalTo(22);
make.left.equalTo(self.blurView.contentView).offset(14);
make.centerY.equalTo(self.cancelBtn);
make.height.mas_equalTo(28);
make.right.lessThanOrEqualTo(self.cancelBtn.mas_left).offset(-8);
}];
[self.avatarView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.equalTo(self.topTicketInfoContainerView);
make.size.mas_equalTo(CGSizeMake(22, 22));
make.left.equalTo(self.topTicketInfoContainerView);
make.centerY.equalTo(self.topTicketInfoContainerView);
make.size.mas_equalTo(CGSizeMake(28, 28));
}];
[self.topTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
......@@ -329,7 +330,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
[self.vipIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.levLabel.mas_right).offset(4);
make.centerY.equalTo(self.avatarView);
make.height.mas_equalTo(14);
make.height.mas_equalTo(kFUSShowTimeTopVipHeight);
make.width.mas_equalTo(0);
}];
......@@ -578,7 +579,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
if (!self.vipIconView.hidden) {
CGSize imageSize = self.vipIconView.image.size;
if (imageSize.height > 0) {
vipWidth = ceil((14.0 * imageSize.width) / imageSize.height);
vipWidth = ceil((kFUSShowTimeTopVipHeight * imageSize.width) / imageSize.height);
}
}
[self.vipIconView mas_updateConstraints:^(MASConstraintMaker *make) {
......@@ -847,13 +848,13 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
[self.cancelBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.blurView.contentView).offset(10);
make.right.equalTo(self.blurView.contentView).offset(-12);
make.size.mas_equalTo(CGSizeMake(83, 26));
make.size.mas_equalTo(CGSizeMake(100, 34));
}];
[self.topDividerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.blurView.contentView).offset(17);
make.right.equalTo(self.blurView.contentView).offset(-17);
make.top.equalTo(self.cancelBtn.mas_bottom).offset(8);
make.top.equalTo(self.cancelBtn.mas_bottom).offset(10);
make.height.mas_equalTo(0.5);
}];
......
......@@ -489,8 +489,8 @@
// ludy: 以前的image需要这个
// _priceBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 6, 0, 6);
// _priceBtn.titleEdgeInsets = UIEdgeInsetsMake(0, -8, 0, 0);
_priceBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -1, 0, -1);
_priceBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 1, 0, 0);
_priceBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -3, 0, -3);
_priceBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
}
}
......
......@@ -109,7 +109,7 @@
// segmentView切换通知
NSString * const kClickCloseBtnNotification = @"kClickCloseBtnNotification";
static CGFloat const kFUSShowTimeFrostedHeight = 120.0;
static CGFloat const kFUSShowTimeFrostedHeight = 130.0;
@interface FUSLiveFunctionView ()
<
......@@ -1372,7 +1372,7 @@ BDAlphaPlayerMetalViewDelegate
// 搭建粒子发射器
- (void)initEmitterView
{
CGFloat width = 150;
CGFloat width = 164;
CGFloat height = (UIView.fus_screenH * (590.0 / 667.0));
......@@ -3693,6 +3693,10 @@ BDAlphaPlayerMetalViewDelegate
return;
}
if (liveType == FUSLiveTypeAudience) {
if (FUSConfig.sharedInstanced.devConfigs.appStatus) {
[self fus_updateGiftInteractAudienceFeatureEnabled:NO];
return;
}
[self fus_updateGiftInteractAudienceFeatureEnabled:switchState];
if (switchState) {
[self fus_refreshGiftInteractAudienceListWithDelay:0.2];
......@@ -3721,6 +3725,10 @@ BDAlphaPlayerMetalViewDelegate
if ([FUSLiveHelper shareInstance].liveType != FUSLiveTypeAudience) {
return;
}
if (FUSConfig.sharedInstanced.devConfigs.appStatus) {
[self fus_updateGiftInteractAudienceFeatureEnabled:NO];
return;
}
FUSRoomInfoModel *roomInfo = [FUSLiveHelper shareInstance].roomInfoModel;
BOOL enabled = roomInfo.stateSwitch ? roomInfo.stateSwitch.giftinteractionstate : NO;
......@@ -3788,7 +3796,7 @@ BDAlphaPlayerMetalViewDelegate
/// 观众端礼物互动面板开关(进房时根据 giftinteractionstate 决定是否展示)
/// 内部兜底校验身份,避免复用场景误创建/误展示
- (void)fus_updateGiftInteractAudienceFeatureEnabled:(BOOL)enabled {
if ([FUSLiveHelper shareInstance].liveType != FUSLiveTypeAudience) {
if ([FUSLiveHelper shareInstance].liveType != FUSLiveTypeAudience || FUSConfig.sharedInstanced.devConfigs.appStatus) {
enabled = NO;
}
......@@ -3842,6 +3850,10 @@ BDAlphaPlayerMetalViewDelegate
if ([FUSLiveHelper shareInstance].liveType != FUSLiveTypeAudience) {
return;
}
if (FUSConfig.sharedInstanced.devConfigs.appStatus) {
[self fus_updateGiftInteractAudienceFeatureEnabled:NO];
return;
}
FUSRoomInfoModel *roomInfo = [FUSLiveHelper shareInstance].roomInfoModel;
BOOL enabled = roomInfo.stateSwitch ? roomInfo.stateSwitch.giftinteractionstate : NO;
if (!enabled) {
......@@ -3894,19 +3906,44 @@ BDAlphaPlayerMetalViewDelegate
}
UIView *containerView = [self fus_viewWithLayer:FUSLiveFunctionLayerManualPopView];
CGFloat containerWidth = containerView ? CGRectGetWidth(containerView.bounds) : UIView.fus_screenW;
CGFloat width = 150;
CGFloat minWidth = 130.0;
CGFloat rightMargin = 10.0;
CGFloat padding = 8.0;
CGFloat contentLeftInset = 14.0;
CGFloat giftIconSize = 18.0;
CGFloat countW = 28.0;
CGFloat labelX = padding + giftIconSize + 4.0 + countW + 8.0;
CGFloat maxLabelWidth = 0.0;
UIFont *labelFont = [UIFont fus_themeFont:12];
for (FUSLiveGiftInteractSettingItemModel *model in self.giftInteractAudienceVisibleList) {
NSString *text = model.name ?: @"";
if (text.length == 0) {
continue;
}
CGSize size = [text boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, ceil(labelFont.lineHeight))
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
attributes:@{NSFontAttributeName: labelFont}
context:nil].size;
maxLabelWidth = MAX(maxLabelWidth, ceil(size.width));
}
CGFloat internalContentWidth = padding + labelX + maxLabelWidth;
CGFloat computedWidth = contentLeftInset + internalContentWidth;
CGFloat maxAllowedWidth = MAX(0.0, containerWidth - rightMargin);
CGFloat width = MIN(MAX(minWidth, computedWidth), maxAllowedWidth);
NSInteger count = MIN(6, self.giftInteractAudienceVisibleList.count);
CGFloat height = 0;
CGFloat headerH = 30;
CGFloat padding = 8;
CGFloat rowHeight = 24;
CGFloat headerH = 35;
CGFloat rowHeight = 26;
if (count > 0) {
height = headerH + padding * 2 + rowHeight * count;
} else {
height = headerH + 40;
}
CGFloat x = containerWidth - 10 - width;
CGFloat x = containerWidth - rightMargin - width;
CGFloat y = UIView.fus_SafeTop + 175;
self.giftInteractAudiencePanelView.frame = CGRectMake(x, y, width, height);
}
......@@ -6594,7 +6631,7 @@ BDAlphaPlayerMetalViewDelegate
if (FUSSwiftLiveHelper.shared.liveType == FUSLiveTypeAnchor) {
[self fus_updateGiftInteractTaskFeatureEnabled:giftInteractEnabled];
} else if (FUSSwiftLiveHelper.shared.liveType == FUSLiveTypeAudience) {
[self fus_updateGiftInteractAudienceFeatureEnabled:giftInteractEnabled];
[self fus_updateGiftInteractAudienceFeatureEnabled:(FUSConfig.sharedInstanced.devConfigs.appStatus ? NO : giftInteractEnabled)];
} else {
[self fus_updateGiftInteractTaskFeatureEnabled:NO];
[self fus_updateGiftInteractAudienceFeatureEnabled:NO];
......@@ -7873,6 +7910,9 @@ BDAlphaPlayerMetalViewDelegate
break;
case FUSLiveRoomScopeTypePay:
if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAnchor) {
[_liveTimeRecordView fus_updateRoomScopeTypeImage:[FUSShowRoomCenterBunble imageNamed:@"live_push_live_time_bg_pay_scope"]];
}
[self.anchorRewardView removeFromSuperview];
self.anchorRewardView = nil;
......
......@@ -5,6 +5,9 @@
@interface FUSLiveGiftInteractAudiencePanelView ()
/// 顶部标题栏容器
@property (nonatomic, strong) UIView *headerView;
@property (nonatomic, strong) UIButton *headerTapButton;
@property (nonatomic, strong) UIButton *scaleButton;
@property (nonatomic, strong) UIView *panelBackgroundView;
/// 顶部icon
@property (nonatomic, strong) UIImageView *headerIconView;
/// 顶部标题(“互动”)
......@@ -21,32 +24,49 @@
@property (nonatomic, strong) NSMutableArray<UIButton *> *itemButtons;
/// 当前展示的条目数组
@property (nonatomic, copy) NSArray<FUSLiveGiftInteractSettingItemModel *> *items;
@property (nonatomic, assign) BOOL collapsed;
@property (nonatomic, assign) CGFloat originalHeight;
@end
@implementation FUSLiveGiftInteractAudiencePanelView
static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLength) {
if (text.length <= maxLength) {
return text;
}
NSRange range = NSMakeRange(0, maxLength);
NSRange safeRange = [text rangeOfComposedCharacterSequencesForRange:range];
return [text substringWithRange:safeRange];
}
static CGFloat const kFUSGiftInteractAudiencePanelLeftInset = 14.0;
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (!self) {
return nil;
}
self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.35];
self.layer.cornerRadius = 8;
self.clipsToBounds = YES;
self.backgroundColor = UIColor.clearColor;
self.clipsToBounds = NO;
self.userInteractionEnabled = YES;
self.originalHeight = CGRectGetHeight(frame);
self.panelBackgroundView = [[UIView alloc] initWithFrame:CGRectZero];
self.panelBackgroundView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.35];
self.panelBackgroundView.layer.cornerRadius = 8;
self.panelBackgroundView.clipsToBounds = YES;
[self addSubview:self.panelBackgroundView];
self.headerView = [[UIView alloc] initWithFrame:CGRectZero];
self.headerView.backgroundColor = [UIColor fus_themeColor];
[self addSubview:self.headerView];
self.headerView.layer.cornerRadius = 8;
self.headerView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
self.headerView.clipsToBounds = YES;
[self.panelBackgroundView addSubview:self.headerView];
self.headerTapButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.headerTapButton addTarget:self action:@selector(fus_onClickScaleToggle) forControlEvents:UIControlEventTouchUpInside];
[self.headerView addSubview:self.headerTapButton];
self.scaleButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.scaleButton.adjustsImageWhenHighlighted = NO;
[self.scaleButton setImage:[FUSShowRoomCenterBunble imageNamed:@"live_anchor_reward_arrow_left"] forState:UIControlStateNormal];
[self.scaleButton setImage:[FUSShowRoomCenterBunble imageNamed:@"live_anchor_reward_arrow_right"] forState:UIControlStateSelected];
self.scaleButton.transform = CGAffineTransformMakeRotation(M_PI);
[self.scaleButton addTarget:self action:@selector(fus_onClickScaleToggle) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:self.scaleButton];
self.headerIconView = [[UIImageView alloc] initWithFrame:CGRectZero];
self.headerIconView.contentMode = UIViewContentModeScaleAspectFit;
......@@ -135,8 +155,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
UIImage *placeholder = [FUSShowRoomCenterBunble imageNamed:@"icon_gift_placehold"];
for (NSInteger i = 0; i < targetCount; i++) {
FUSLiveGiftInteractSettingItemModel *model = self.items[i];
NSString *action = model.name ?: @"";
NSString *text = fus_substringComposedToLength(action, 6);
NSString *text = model.name;
UILabel *textLabel = self.textLabels[i];
textLabel.text = text ?: @"";
......@@ -168,8 +187,15 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
CGFloat headerH = 35;
CGFloat padding = 8;
CGFloat contentX = kFUSGiftInteractAudiencePanelLeftInset;
CGFloat contentW = MAX(0, CGRectGetWidth(self.bounds) - contentX);
self.headerView.frame = CGRectMake(0, 0, CGRectGetWidth(self.bounds), headerH);
self.panelBackgroundView.frame = CGRectMake(contentX, 0, contentW, CGRectGetHeight(self.bounds));
self.headerView.frame = CGRectMake(0, 0, contentW, headerH);
self.headerTapButton.frame = self.headerView.bounds;
CGFloat scaleBtnSize = 16;
self.scaleButton.frame = CGRectMake(0, (headerH - scaleBtnSize) * 0.5, scaleBtnSize, scaleBtnSize);
[self bringSubviewToFront:self.scaleButton];
CGFloat iconSize = 16;
CGFloat spacing = 4;
CGSize titleSize = [self.headerTitleLabel sizeThatFits:CGSizeMake(CGFLOAT_MAX, headerH)];
......@@ -184,7 +210,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
CGFloat contentTop = CGRectGetMaxY(self.headerView.frame);
if (self.items.count == 0) {
self.emptyLabel.frame = CGRectMake(0, contentTop, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds) - contentTop);
self.emptyLabel.frame = CGRectMake(contentX, contentTop, contentW, CGRectGetHeight(self.bounds) - contentTop);
return;
}
......@@ -195,7 +221,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
CGFloat giftIconX = padding;
CGFloat giftCountX = giftIconX + giftIconSize + 4;
CGFloat labelX = giftCountX + countW + 8;
CGFloat labelW = CGRectGetWidth(self.bounds) - padding - labelX;
CGFloat labelW = contentW - padding - labelX;
if (labelW < 0) {
labelW = 0;
}
......@@ -205,20 +231,64 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
for (NSInteger i = 0; i < self.items.count; i++) {
CGFloat y = contentTop + padding + i * rowHeight;
UILabel *label = self.textLabels[i];
label.frame = CGRectMake(labelX, y, labelW, rowHeight);
label.frame = CGRectMake(contentX + labelX, y, labelW, rowHeight);
UIImageView *iconView = self.giftIconViews[i];
iconView.frame = CGRectMake(giftIconX, y + (rowHeight - giftIconSize) * 0.5, giftIconSize, giftIconSize);
iconView.frame = CGRectMake(contentX + giftIconX, y + (rowHeight - giftIconSize) * 0.5, giftIconSize, giftIconSize);
CBAutoScrollLabel *countLabel = self.giftCountLabels[i];
countLabel.frame = CGRectMake(giftCountX, y, countW, rowHeight);
countLabel.frame = CGRectMake(contentX + giftCountX, y, countW, rowHeight);
UIButton *btn = self.itemButtons[i];
btn.frame = CGRectMake(0, y, CGRectGetWidth(self.bounds), rowHeight);
btn.frame = CGRectMake(contentX, y, contentW, rowHeight);
btn.tag = i;
}
}
- (void)fus_onClickScaleToggle {
CGFloat headerH = 35;
if (!self.collapsed) {
self.collapsed = YES;
self.scaleButton.selected = YES;
self.originalHeight = MAX(self.originalHeight, self.height);
CGFloat scaleFactor = 0.617;
CGFloat translateX = CGRectGetWidth(self.bounds) * (1.0 - scaleFactor) * 0.5;
[self fus_setContentHidden:YES];
[UIView animateWithDuration:0.3 animations:^{
self.height = headerH;
CGAffineTransform collapsedTransform = CGAffineTransformIdentity;
collapsedTransform = CGAffineTransformTranslate(collapsedTransform, translateX, -headerH * scaleFactor / 2.0);
collapsedTransform = CGAffineTransformScale(collapsedTransform, scaleFactor, scaleFactor);
self.transform = collapsedTransform;
}];
return;
}
self.collapsed = NO;
self.scaleButton.selected = NO;
[UIView animateWithDuration:0.3 animations:^{
self.transform = CGAffineTransformIdentity;
self.height = MAX(self.originalHeight, headerH);
} completion:^(BOOL finished) {
[self fus_setContentHidden:NO];
}];
}
- (void)fus_setContentHidden:(BOOL)hidden {
self.emptyLabel.hidden = hidden || self.items.count > 0;
for (UILabel *label in self.textLabels) {
label.hidden = hidden;
}
for (UIImageView *imgView in self.giftIconViews) {
imgView.hidden = hidden;
}
for (CBAutoScrollLabel *label in self.giftCountLabels) {
label.hidden = hidden;
}
for (UIButton *btn in self.itemButtons) {
btn.hidden = hidden;
}
}
- (void)fus_onItemButtonClick:(UIButton *)btn {
NSInteger index = btn.tag;
if (index >= 0 && index < self.items.count) {
......
......@@ -158,7 +158,7 @@
nicknameLabel.text = nickname;
CBAutoScrollLabel *taskLabel = self.taskLabels[i];
NSString *task = model.name ?: @"";
NSString *task = [NSString stringAddFromNilWith:model.name] ?: @"";
taskLabel.text = task;
UIButton *btn = self.doneButtons[i];
......
......@@ -126,7 +126,7 @@ static CGFloat const kFUSPayRoomCompanionMinWidth = 120.0;
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
self.blurView = [[UIVisualEffectView alloc] initWithEffect:effect];
self.blurView.frame = self.contentView.bounds;
self.blurView.alpha = 0.85;
self.blurView.alpha = 0.2;
[self.contentView addSubview:self.blurView];
self.arrowBtn = [UIButton buttonWithType:UIButtonTypeCustom];
......@@ -193,7 +193,7 @@ static CGFloat const kFUSPayRoomCompanionMinWidth = 120.0;
self.diamondIconView.image = UIImage.fus_diamonIcon;
[self.contentView addSubview:self.diamondIconView];
CGFloat priceX = self.diamondIconView.right + 6;
CGFloat priceX = self.diamondIconView.right + 2;
CGFloat priceW = MAX(0, self.contentView.width - contentPadding - priceX);
self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(priceX, y - 1, priceW, 12)];
self.priceLabel.font = [UIFont boldSystemFontOfSize:8];
......
......@@ -412,7 +412,7 @@ static NSInteger const kFUSPayRoomEntryMainViewTag = 90917003;
if (digitRange.location != NSNotFound && NSMaxRange(digitRange) <= safeText.length) {
NSAttributedString *attachmentAttr = [NSAttributedString attributedStringWithAttachment:attachment];
NSAttributedString *spaceAttr = [[NSAttributedString alloc] initWithString:@" " attributes:@{
NSAttributedString *spaceAttr = [[NSAttributedString alloc] initWithString:@"\u2009" attributes:@{
NSFontAttributeName: self.bottomTipLabel.font,
NSForegroundColorAttributeName: normalTextColor
}];
......
......@@ -77,6 +77,10 @@
@implementation FusAnchorPayRoomView
static CGFloat const kFUSAnchorPayRoomMinViewWidth = 120.0;
static CGFloat const kFUSAnchorPayRoomArrowWidth = 14.0;
static CGFloat const kFUSAnchorPayRoomStatsHorizontalPadding = 9.0;
+ (FusAnchorPayRoomView *)fus_createAnchorPayRoomViewIfNeeded {
if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAnchor) {
......@@ -87,7 +91,7 @@
return nil;
}
CGFloat viewW = 120;
CGFloat viewW = kFUSAnchorPayRoomMinViewWidth;
CGFloat viewH = 123;
CGFloat viewY = UIView.fus_SafeTop + 205;
......@@ -125,7 +129,7 @@
UIBlurEffect *effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
self.blurView = [[UIVisualEffectView alloc] initWithEffect:effect];
self.blurView.frame = self.contentView.bounds;
self.blurView.alpha = 0.85;
self.blurView.alpha = 0.2;
[self.contentView addSubview:self.blurView];
self.headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.width, 33)];
......@@ -345,6 +349,39 @@
self.accompanyLabel.attributedText = [self fus_infoLineWithTitle:[NSString fus_localString:@"陪伴中:"] value:accompanyValue suffix:[NSString fus_localString:@"人"]];
self.trialLabel.attributedText = [self fus_infoLineWithTitle:[NSString fus_localString:@"试看中:"] value:trialValue suffix:[NSString fus_localString:@"人"]];
self.incomeLabel.attributedText = [self fus_incomeLineWithValue:incomeValue];
[self fus_updateWidthIfNeeded];
}
- (CGFloat)fus_textWidthForLabel:(UILabel *)label {
if (label.attributedText.length <= 0) {
return 0;
}
CGRect rect = [label.attributedText boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, 20) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading context:nil];
return ceil(rect.size.width);
}
- (void)fus_updateWidthIfNeeded {
if (!CGAffineTransformIsIdentity(self.transform)) {
return;
}
CGFloat titleTextWidth = ceil([self.titleLabel sizeThatFits:CGSizeMake(CGFLOAT_MAX, 33)].width);
CGFloat titleRequiredWidth = 16 + 6 + titleTextWidth + 16;
CGFloat accompanyWidth = [self fus_textWidthForLabel:self.accompanyLabel];
CGFloat trialWidth = [self fus_textWidthForLabel:self.trialLabel];
CGFloat incomeWidth = [self fus_textWidthForLabel:self.incomeLabel];
CGFloat maxStatsWidth = MAX(accompanyWidth, MAX(trialWidth, incomeWidth));
CGFloat statsRequiredWidth = maxStatsWidth + kFUSAnchorPayRoomStatsHorizontalPadding * 2.0;
CGFloat contentWidth = MAX(106.0, MAX(titleRequiredWidth, statsRequiredWidth));
CGFloat targetWidth = MAX(kFUSAnchorPayRoomMinViewWidth, contentWidth + kFUSAnchorPayRoomArrowWidth);
if (fabs(self.width - targetWidth) <= 0.5) {
return;
}
CGFloat originX = self.left;
self.frame = CGRectMake(originX, self.top, targetWidth, self.height);
[self setNeedsLayout];
[self layoutIfNeeded];
}
......
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