Commit 8ed0da73 by suolong

修复uibug

parent 366330a0
...@@ -3530,7 +3530,7 @@ ...@@ -3530,7 +3530,7 @@
"已集票数:--/--" = "已集票数:--/--"; "已集票数:--/--" = "已集票数:--/--";
"票的贡献" = "票贡献"; "票的贡献" = "票贡献";
"活动须知" = "活动须知"; "活动须知" = "活动须知";
......
...@@ -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 = 202506260058; CURRENT_PROJECT_VERSION = 202506260059;
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 = 202506260058; CURRENT_PROJECT_VERSION = 202506260059;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC; DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO; ENABLE_ON_DEMAND_RESOURCES = NO;
......
...@@ -1385,13 +1385,10 @@ static NSInteger const kFUSPayRoomCompanionPopViewTagLeft = 90917002; ...@@ -1385,13 +1385,10 @@ static NSInteger const kFUSPayRoomCompanionPopViewTagLeft = 90917002;
viewModel.primaryButtonTitle = (diamondEnough ? [NSString fus_localString:@"进入陪伴"] : [NSString fus_localString:@"马上储值进入陪伴"]); viewModel.primaryButtonTitle = (diamondEnough ? [NSString fus_localString:@"进入陪伴"] : [NSString fus_localString:@"马上储值进入陪伴"]);
viewModel.trialButtonHidden = (previewTime <= 0); viewModel.trialButtonHidden = (previewTime <= 0);
if (previewTime > 0) {
viewModel.trialButtonTitle = [NSString stringWithFormat:[NSString fus_localString:@"试看%ldS"], (long)previewTime]; viewModel.trialButtonTitle = [NSString stringWithFormat:[NSString fus_localString:@"试看%ldS"], (long)previewTime];
}
if (pricePerMinute > 0) { viewModel.bottomTipText = ([NSString stringWithFormat:[NSString fus_localString:@"您可陪伴%ld分钟,%ld/分钟"], (long)canCompanionTime, (long)pricePerMinute]);
viewModel.bottomTipText = (canCompanionTime > 0 ? [NSString stringWithFormat:[NSString fus_localString:@"您可陪伴%ld分钟,%ld/分钟"], (long)canCompanionTime, (long)pricePerMinute] : [NSString stringWithFormat:[NSString fus_localString:@"%ld/分钟"], (long)pricePerMinute]);
}
return viewModel; return viewModel;
} }
......
...@@ -85,29 +85,25 @@ ...@@ -85,29 +85,25 @@
BOOL isMute = [FUSLiveHelper fus_livePushMuteState]; BOOL isMute = [FUSLiveHelper fus_livePushMuteState];
NSString *muteStr = isMute ? [NSString fus_localString:@"打开麦克风"] : [NSString fus_localString:@"关闭麦克风"]; NSString *muteStr = isMute ? [NSString fus_localString:@"打开麦克风"] : [NSString fus_localString:@"关闭麦克风"];
NSString *muteImgStr = isMute ? @"live_setting_open_mic" : @"live_setting_close_mic"; NSString *muteImgStr = isMute ? @"live_setting_open_mic" : @"live_setting_close_mic";
[self showOptionalViewWithTitleArray:@[[NSString fus_localString:@"美颜设置"], NSMutableArray *titles = [NSMutableArray arrayWithArray:@[[NSString fus_localString:@"美颜设置"],
[NSString fus_localString:@"清晰度"], [NSString fus_localString:@"清晰度"],
// [NSString fus_localString:@"关闭麦克风"],
muteStr, muteStr,
[NSString fus_localString:@"反转镜头"], [NSString fus_localString:@"反转镜头"],
[NSString fus_localString:@"闪光关闭"], [NSString fus_localString:@"闪光关闭"],
[NSString fus_localString:@"镜像"], [NSString fus_localString:@"镜像"],
[NSString fus_localString:@"贴纸"], [NSString fus_localString:@"贴纸"],
[NSString fus_localString:@"快捷发言"], [NSString fus_localString:@"快捷发言"],
[NSString fus_localString:@"直播主题"], [NSString fus_localString:@"直播主题"]]];
[NSString fus_localString:@"礼物互动"]] NSMutableArray *images = [NSMutableArray arrayWithArray:@[@"live_icon_cameraSetting",
withImages:@[@"live_icon_cameraSetting",
@"live_setting_quality", @"live_setting_quality",
// @"live_setting_close_mic",
muteImgStr, muteImgStr,
@"live_icon_changeCamera", @"live_icon_changeCamera",
@"live_icon_turnOffLine", @"live_icon_turnOffLine",
@"live_setting_video_mirror", @"live_setting_video_mirror",
@"live_setting_live_sticker", @"live_setting_live_sticker",
@"live_setting_live_quickChat", @"live_setting_live_quickChat",
@"live_setting_live_theme", @"live_setting_live_theme"]];
@"live_setting_live_giftInteract"] NSMutableArray *types = [NSMutableArray arrayWithArray:@[@(FUSFaceBeautySetting),
withTypes:@[@(FUSFaceBeautySetting),
@(FUSLiveQuality), @(FUSLiveQuality),
@(FUSLiveCameraMic), @(FUSLiveCameraMic),
@(FUSFaceBeautychangeCamera), @(FUSFaceBeautychangeCamera),
...@@ -115,8 +111,15 @@ ...@@ -115,8 +111,15 @@
@(FUSLiveCameraMirror), @(FUSLiveCameraMirror),
@(FUSLiveSetSticker), @(FUSLiveSetSticker),
@(FUSLiveEditQuickChat), @(FUSLiveEditQuickChat),
@(FUSLiveRoomTheme), @(FUSLiveRoomTheme)]];
@(FUSLiveGiftInteract)] if (!FUSConfig.sharedInstanced.devConfigs.appStatus) {
[titles addObject:[NSString fus_localString:@"礼物互动"]];
[images addObject:@"live_setting_live_giftInteract"];
[types addObject:@(FUSLiveGiftInteract)];
}
[self showOptionalViewWithTitleArray:titles
withImages:images
withTypes:types
clickItem:click]; clickItem:click];
}else if(type == FUSShowFlashLineAndCamera){ }else if(type == FUSShowFlashLineAndCamera){
......
...@@ -188,6 +188,9 @@ ...@@ -188,6 +188,9 @@
break; break;
case FUSLiveBottomToolTypeShowTime: case FUSLiveBottomToolTypeShowTime:
{ {
if (FUSConfig.sharedInstanced.devConfigs.appStatus) {
return;
}
if ([self.delegate respondsToSelector:@selector(fus_bottomSubView:didClickShowTimeOnView:)]) { if ([self.delegate respondsToSelector:@selector(fus_bottomSubView:didClickShowTimeOnView:)]) {
UIView *container = bgView ?: self.bgView ?: [UIViewController fus_topViewController].view; UIView *container = bgView ?: self.bgView ?: [UIViewController fus_topViewController].view;
[self.delegate fus_bottomSubView:self didClickShowTimeOnView:container]; [self.delegate fus_bottomSubView:self didClickShowTimeOnView:container];
...@@ -614,10 +617,18 @@ ...@@ -614,10 +617,18 @@
- (void)ffupdateToolView2TypesPKState:(FUSPKState)pkState { - (void)ffupdateToolView2TypesPKState:(FUSPKState)pkState {
NSMutableArray *toolTypesList = [[NSMutableArray alloc] init]; NSMutableArray *toolTypesList = [[NSMutableArray alloc] init];
BOOL isReviewMode = FUSConfig.sharedInstanced.devConfigs.appStatus;
if (FUSLiveHelper.shareInstance.liveRoomType == FUSRoomTypeLinkMic) { if (FUSLiveHelper.shareInstance.liveRoomType == FUSRoomTypeLinkMic) {
[toolTypesList appendObjects:@[@(FUSLiveBottomToolTypeLiveSetting),@(FUSLiveBottomToolTypeRoomSetting),@(FUSLiveBottomToolTypeShowTime)/*,@(FFLiveBottomToolTypeRoomScope), @(FFLiveBottomToolTypeNovaBuild)*/]]; [toolTypesList appendObjects:@[@(FUSLiveBottomToolTypeLiveSetting),@(FUSLiveBottomToolTypeRoomSetting)]];
if (!isReviewMode) {
[toolTypesList addObject:@(FUSLiveBottomToolTypeShowTime)];
}
} else { } else {
[toolTypesList appendObjects:@[@(FUSLiveBottomToolTypeLiveSetting),@(FUSLiveBottomToolTypeRoomSetting),@(FUSLiveBottomToolTypeShowTime),@(FUSLiveBottomToolTypePK)/*,@(FUSLiveBottomToolTypeRoomScope), @(FUSLiveBottomToolTypeNovaBuild)*/]]; [toolTypesList appendObjects:@[@(FUSLiveBottomToolTypeLiveSetting),@(FUSLiveBottomToolTypeRoomSetting)]];
if (!isReviewMode) {
[toolTypesList addObject:@(FUSLiveBottomToolTypeShowTime)];
}
[toolTypesList addObject:@(FUSLiveBottomToolTypePK)];
// [toolTypesList appendObjects:@[@(FFLiveBottomToolTypeLiveSetting),@(FFLiveBottomToolTypeRoomSetting), @(FFLiveBottomToolTypeRoomScope),@(FFLiveBottomToolTypeBeautySticker), @(FFLiveBottomToolTypeNovaBuild)]]; // [toolTypesList appendObjects:@[@(FFLiveBottomToolTypeLiveSetting),@(FFLiveBottomToolTypeRoomSetting), @(FFLiveBottomToolTypeRoomScope),@(FFLiveBottomToolTypeBeautySticker), @(FFLiveBottomToolTypeNovaBuild)]];
} }
......
...@@ -217,11 +217,50 @@ import RxCocoa ...@@ -217,11 +217,50 @@ import RxCocoa
// 对外一些方法 // 对外一些方法
extension FUSLiveChatInputToolAlertView{ extension FUSLiveChatInputToolAlertView{
private func fus_toolPreferredOrder() -> [FUSLiveBottomToolType] {
return [
FUSLiveBottomToolTypeMessageBox,
FUSLiveBottomToolTypeTask,
FUSLiveBottomToolTypeExchange,
FUSLiveBottomToolTypeScreenShot,
FUSLiveBottomToolTypeRoomSetting,
FUSLiveBottomToolTypeStartPictureInPicture,
FUSLiveBottomToolTypeMessage,
FUSLiveBottomToolTypeAudienceMessage,
FUSLiveBottomToolTypeLiveSetting,
FUSLiveBottomToolTypeShowTime,
FUSLiveBottomToolTypeLiveManage,
FUSLiveBottomToolTypePK,
FUSLiveBottomToolTypeRoomScope,
FUSLiveBottomToolTypeBeautySticker
]
}
/// 添加模型 /// 添加模型
@objc public func showItemWithTypes(toolTypes types:[Int]){ @objc public func showItemWithTypes(toolTypes types:[Int]){
self.collectionItemList.removeAll() self.collectionItemList.removeAll()
self.typesList.removeAll() self.typesList.removeAll()
if self.toolViewType == FUSLiveBottomToolTypeTool {
var orderedItemList: [FUSLiveBottomToolType] = .init()
for itemType in self.fus_toolPreferredOrder() {
if types.contains(itemType.rawValue) {
orderedItemList.append(itemType)
}
}
if orderedItemList.count > 0 {
let sectionModel = FUSLiveChatInputToolAlertSectionModel()
sectionModel.type = .liveFunction
sectionModel.functionList = orderedItemList
self.collectionItemList.append(sectionModel)
self.typesList = orderedItemList
}
self.fus_reloadUI()
self.fus_rebindModel()
return
}
// 取出section的顺序 // 取出section的顺序
for sectionType in self.sectionSequence { for sectionType in self.sectionSequence {
......
...@@ -175,11 +175,11 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10; ...@@ -175,11 +175,11 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
FUSShowTimePaddingLabel *levLabel = [[FUSShowTimePaddingLabel alloc] init]; FUSShowTimePaddingLabel *levLabel = [[FUSShowTimePaddingLabel alloc] init];
levLabel.textInsets = UIEdgeInsetsMake(0, 6, 0, 6); levLabel.textInsets = UIEdgeInsetsMake(0, 6, 0, 6);
levLabel.layer.cornerRadius = 9; levLabel.layer.cornerRadius = 7;
levLabel.layer.masksToBounds = YES; levLabel.layer.masksToBounds = YES;
levLabel.backgroundColor = [UIColor colorWithWhite:1 alpha:0.9]; levLabel.backgroundColor = [UIColor colorWithWhite:1 alpha:0.9];
self.levLabel = levLabel; self.levLabel = levLabel;
self.levLabel.font = [UIFont fus_themeFont:11]; self.levLabel.font = [UIFont fus_themeFont:12];
self.levLabel.textColor = [UIColor colorWithWhite:0 alpha:0.8]; self.levLabel.textColor = [UIColor colorWithWhite:0 alpha:0.8];
self.levLabel.textAlignment = NSTextAlignmentCenter; self.levLabel.textAlignment = NSTextAlignmentCenter;
self.levLabel.text = @"0"; self.levLabel.text = @"0";
...@@ -323,26 +323,26 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10; ...@@ -323,26 +323,26 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
[self.levLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.levLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.topTitleLabel.mas_right).offset(4); make.left.equalTo(self.topTitleLabel.mas_right).offset(4);
make.centerY.equalTo(self.topTitleLabel); make.centerY.equalTo(self.topTitleLabel);
make.height.mas_equalTo(18); make.height.equalTo(self.vipIconView.mas_height);
}]; }];
[self.vipIconView mas_makeConstraints:^(MASConstraintMaker *make) { [self.vipIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.levLabel.mas_right).offset(4); make.left.equalTo(self.levLabel.mas_right).offset(4);
make.top.equalTo(self.topTitleLabel); make.centerY.equalTo(self.avatarView);
make.height.mas_equalTo(14); make.height.mas_equalTo(14);
make.width.mas_equalTo(0); make.width.mas_equalTo(0);
}]; }];
[self.ticketIconView mas_makeConstraints:^(MASConstraintMaker *make) { [self.ticketIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.levLabel.mas_right).offset(35); make.left.equalTo(self.vipIconView.mas_right).offset(12);
make.centerY.equalTo(self.topTicketInfoContainerView); make.centerY.equalTo(self.avatarView);
make.size.mas_equalTo(CGSizeMake(23, 13.5)); make.size.mas_equalTo(CGSizeMake(23, 13.5));
make.right.lessThanOrEqualTo(self.topTicketInfoContainerView); make.right.lessThanOrEqualTo(self.topTicketInfoContainerView);
}]; }];
[self.showTimeNewTicketLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.showTimeNewTicketLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.ticketIconView.mas_right).offset(2); make.left.equalTo(self.ticketIconView.mas_right).offset(2);
make.centerY.equalTo(self.topTicketInfoContainerView); make.centerY.equalTo(self.avatarView);
make.height.mas_equalTo(18); make.height.mas_equalTo(18);
make.right.lessThanOrEqualTo(self.topTicketInfoContainerView); make.right.lessThanOrEqualTo(self.topTicketInfoContainerView);
}]; }];
...@@ -398,12 +398,16 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10; ...@@ -398,12 +398,16 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
if (!self.progressLabel) { if (!self.progressLabel) {
self.progressLabel = [[UILabel alloc] init]; self.progressLabel = [[UILabel alloc] init];
self.progressLabel.textAlignment = NSTextAlignmentCenter; self.progressLabel.textAlignment = NSTextAlignmentCenter;
self.progressLabel.font = [UIFont fus_themeBoldFont:8]; self.progressLabel.font = [UIFont fus_themeBoldFont:12];
self.progressLabel.textColor = UIColor.whiteColor; self.progressLabel.textColor = UIColor.whiteColor;
self.progressLabel.adjustsFontSizeToFitWidth = YES;
self.progressLabel.minimumScaleFactor = 0.7;
self.progressLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
self.progressLabel.allowsDefaultTighteningForTruncation = YES;
self.progressLabel.text = @"0%"; self.progressLabel.text = @"0%";
[self.progressContainer addSubview:self.progressLabel]; [self.progressContainer addSubview:self.progressLabel];
[self.progressLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.progressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.progressContainer); make.edges.equalTo(self.progressContainer).insets(UIEdgeInsetsMake(8, 8, 8, 8));
}]; }];
} }
......
...@@ -384,12 +384,32 @@ static NSInteger const kFUSPayRoomEntryMainViewTag = 90917003; ...@@ -384,12 +384,32 @@ static NSInteger const kFUSPayRoomEntryMainViewTag = 90917003;
NSForegroundColorAttributeName: normalTextColor NSForegroundColorAttributeName: normalTextColor
}]; }];
NSError *regexError = nil; NSRange commaRange = [safeText rangeOfString:@"," options:NSBackwardsSearch];
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(\\d+)\\/分钟" options:0 error:&regexError]; if (commaRange.location == NSNotFound) {
NSArray<NSTextCheckingResult *> *matches = (regexError ? @[] : [regex matchesInString:safeText options:0 range:NSMakeRange(0, safeText.length)]); commaRange = [safeText rangeOfString:@"," options:NSBackwardsSearch];
}
NSRange digitRange = NSMakeRange(NSNotFound, 0);
if (commaRange.location != NSNotFound && NSMaxRange(commaRange) < safeText.length) {
NSRange suffixRange = NSMakeRange(NSMaxRange(commaRange), safeText.length - NSMaxRange(commaRange));
NSError *suffixRegexError = nil;
NSRegularExpression *suffixRegex = [NSRegularExpression regularExpressionWithPattern:@"(\\d+)" options:0 error:&suffixRegexError];
NSTextCheckingResult *suffixMatch = (suffixRegexError ? nil : [suffixRegex firstMatchInString:safeText options:0 range:suffixRange]);
if (suffixMatch && suffixMatch.numberOfRanges > 1) {
digitRange = [suffixMatch rangeAtIndex:1];
}
}
if (digitRange.location == NSNotFound) {
NSError *fallbackRegexError = nil;
NSRegularExpression *fallbackRegex = [NSRegularExpression regularExpressionWithPattern:@"(\\d+)\\s*/" options:0 error:&fallbackRegexError];
NSArray<NSTextCheckingResult *> *matches = (fallbackRegexError ? @[] : [fallbackRegex matchesInString:safeText options:0 range:NSMakeRange(0, safeText.length)]);
NSTextCheckingResult *lastMatch = matches.lastObject; NSTextCheckingResult *lastMatch = matches.lastObject;
if (lastMatch && lastMatch.numberOfRanges > 1) { if (lastMatch && lastMatch.numberOfRanges > 1) {
NSRange digitRange = [lastMatch rangeAtIndex:1]; digitRange = [lastMatch rangeAtIndex:1];
}
}
if (digitRange.location != NSNotFound && NSMaxRange(digitRange) <= safeText.length) { if (digitRange.location != NSNotFound && NSMaxRange(digitRange) <= safeText.length) {
NSAttributedString *attachmentAttr = [NSAttributedString attributedStringWithAttachment:attachment]; NSAttributedString *attachmentAttr = [NSAttributedString attributedStringWithAttachment:attachment];
NSAttributedString *spaceAttr = [[NSAttributedString alloc] initWithString:@" " attributes:@{ NSAttributedString *spaceAttr = [[NSAttributedString alloc] initWithString:@" " attributes:@{
...@@ -402,7 +422,6 @@ static NSInteger const kFUSPayRoomEntryMainViewTag = 90917003; ...@@ -402,7 +422,6 @@ static NSInteger const kFUSPayRoomEntryMainViewTag = 90917003;
[textAttr addAttribute:NSForegroundColorAttributeName value:jewelTextColor range:NSMakeRange(digitRange.location + 2, digitRange.length)]; [textAttr addAttribute:NSForegroundColorAttributeName value:jewelTextColor range:NSMakeRange(digitRange.location + 2, digitRange.length)];
} }
}
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.alignment = NSTextAlignmentCenter; paragraphStyle.alignment = NSTextAlignmentCenter;
......
...@@ -59,6 +59,7 @@ import FUSCommon ...@@ -59,6 +59,7 @@ import FUSCommon
public var requestType: Int = 0 public var requestType: Int = 0
/// 普通嘉宾就是,0:公开,1:粉丝,2,私密 特别嘉宾就是 锁定类型:0:不锁定、1:付费、2:密码 /// 普通嘉宾就是,0:公开,1:粉丝,2,私密 特别嘉宾就是 锁定类型:0:不锁定、1:付费、2:密码
public var scopeType = FUSLiveRoomScopeType.open public var scopeType = FUSLiveRoomScopeType.open
private var availableScopeTypes: [FUSLiveRoomScopeType] = []
let contentViewHeight = 312.0 + UIView.fus_SafeBottom() let contentViewHeight = 312.0 + UIView.fus_SafeBottom()
let contentView = FUSPanGestureAlertView(frame: CGRectMake(0, 0, UIView.fus_screenW(), 312)) let contentView = FUSPanGestureAlertView(frame: CGRectMake(0, 0, UIView.fus_screenW(), 312))
...@@ -118,48 +119,53 @@ import FUSCommon ...@@ -118,48 +119,53 @@ import FUSCommon
make.bottom.equalToSuperview().offset(-(14 + UIView.fus_SafeBottom())) make.bottom.equalToSuperview().offset(-(14 + UIView.fus_SafeBottom()))
} }
let iconImagesList: [String] struct ScopeItem {
let titlesList: [String] let scopeType: FUSLiveRoomScopeType
let subTitlesList: [String] let icon: String
if requestType == 0 { let title: String
iconImagesList = ["live_start_openScope_cell", let subTitle: String
"live_start_passwordScope_cell", }
"live_start_payScope_cell"] let isReviewMode = FUSConfig.sharedInstanced().devConfigs.appStatus
titlesList = [String.fus_localString("公开屋"), var scopeItems: [ScopeItem] = [
.fus_localString("私享屋"), ScopeItem(scopeType: .open,
.fus_localString("付费屋")] icon: "live_start_openScope_cell",
subTitlesList = [String.fus_localString("所有人可进入房间"), title: .fus_localString("公开屋"),
.fus_localString("已关闭窗帘,玩家输入密码打开"), subTitle: .fus_localString("所有人可进入房间")),
.fus_localString("玩家需付费观看")] ScopeItem(scopeType: .password,
} else { icon: "live_start_passwordScope_cell",
iconImagesList = ["live_start_openScope_cell", title: .fus_localString("私享屋"),
"live_start_passwordScope_cell", subTitle: .fus_localString("已关闭窗帘,玩家输入密码打开"))
"live_start_payScope_cell"] ]
titlesList = [String.fus_localString("公开屋"), if !isReviewMode {
.fus_localString("私享屋"), scopeItems.append(
.fus_localString("付费屋")] ScopeItem(scopeType: .pay,
subTitlesList = [String.fus_localString("所有人可进入房间"), icon: "live_start_payScope_cell",
.fus_localString("已关闭窗帘,玩家输入密码打开"), title: .fus_localString("付费屋"),
.fus_localString("玩家需付费观看")] subTitle: .fus_localString("玩家需付费观看"))
)
}
self.availableScopeTypes = scopeItems.map { $0.scopeType }
if isReviewMode && self.scopeType == .pay {
self.scopeType = .open
} }
let itemHeight = 56.0 let itemHeight = 56.0
privacyContentView.snp.makeConstraints { make in privacyContentView.snp.makeConstraints { make in
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
make.top.equalTo(titleLabel.snp.bottom).offset(16) make.top.equalTo(titleLabel.snp.bottom).offset(16)
make.height.equalTo(titlesList.count * Int(itemHeight) + 10) make.height.equalTo(scopeItems.count * Int(itemHeight) + 10)
} }
let selectIndex = fus_getIndexWithScopeType() let selectIndex = fus_getIndexWithScopeType()
for (index, iconStr) in iconImagesList.enumerated() { for (index, item) in scopeItems.enumerated() {
var canSelect = true var canSelect = true
if index == 0 { if index == 0 {
if FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData?.liveScopeOpen.intValue == -1 { if FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData?.liveScopeOpen.intValue == -1 {
canSelect = false canSelect = false
} }
} }
let itemView = FUSLiveStartSetPrivacyItemView.fus_create(icon: iconStr, title: titlesList[index], subTitle: subTitlesList[index], canSelect: canSelect) let itemView = FUSLiveStartSetPrivacyItemView.fus_create(icon: item.icon, title: item.title, subTitle: item.subTitle, canSelect: canSelect)
if index == 2 { if item.scopeType == .pay {
if let payData = FUSLiveHelper.shareInstance().liveBeforeReadyInfo?.payData, if let payData = FUSLiveHelper.shareInstance().liveBeforeReadyInfo?.payData,
(payData.enable ?? "0").intValue != 1 { (payData.enable ?? "0").intValue != 1 {
let warnSubTitle = payData.warnSubTitle ?? "" let warnSubTitle = payData.warnSubTitle ?? ""
...@@ -227,18 +233,22 @@ import FUSCommon ...@@ -227,18 +233,22 @@ import FUSCommon
} }
func fus_itemDidSelected(index: Int){ func fus_itemDidSelected(index: Int){
if index < 0 || index >= self.availableScopeTypes.count {
return
}
let selectedScopeType = self.availableScopeTypes[index]
switch index{ switch selectedScopeType {
case 0: case .open:
if FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData?.liveScopeOpen.intValue == -1 { if FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData?.liveScopeOpen.intValue == -1 {
self.scopeType = .password self.scopeType = .password
} else { } else {
self.scopeType = .open self.scopeType = .open
} }
case 1: case .password:
self.scopeType = .password self.scopeType = .password
case 2: case .pay:
if let payData = FUSLiveHelper.shareInstance().liveBeforeReadyInfo?.payData { // 判断是否允许付费屋 if let payData = FUSLiveHelper.shareInstance().liveBeforeReadyInfo?.payData { // 判断是否允许付费屋
if (payData.enable ?? "0").intValue != 1 { if (payData.enable ?? "0").intValue != 1 {
let warnTitle = payData.warnTitle ?? "" let warnTitle = payData.warnTitle ?? ""
...@@ -257,8 +267,6 @@ import FUSCommon ...@@ -257,8 +267,6 @@ import FUSCommon
self?.fus_itemDidSelected(index: index) self?.fus_itemDidSelected(index: index)
} }
} }
// case 2:
// self.scopeType = .intimacy
default: default:
break break
} }
...@@ -277,18 +285,10 @@ import FUSCommon ...@@ -277,18 +285,10 @@ import FUSCommon
// 强化判断,不强依赖类型 // 强化判断,不强依赖类型
func fus_getIndexWithScopeType() -> Int { func fus_getIndexWithScopeType() -> Int {
switch self.scopeType{ if let index = self.availableScopeTypes.firstIndex(of: self.scopeType) {
case .open: return index
return 0
case .password:
return 1
case .pay:
return 2
// case .intimacy:
// return 2
@unknown default:
return 0
} }
return 0
} }
func fus_showWithAnimation(){ func fus_showWithAnimation(){
......
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