Commit 131a2c3a by ludi

Merge branch 'feature/7840付费房' of http://git.yabolive.net:88/pidan/FuSiLive into feature/7840付费房

parents 0224dd98 76cce0cc
......@@ -3530,7 +3530,7 @@
"已集票数:--/--" = "已集票数:--/--";
"票的贡献" = "票贡献";
"票的贡献" = "票贡献";
"活动须知" = "活动须知";
......
......@@ -35,6 +35,10 @@
// 视频帧是否回调
@property (nonatomic, assign) BOOL openVideoFrameCallBack;
@property (nonatomic, strong) FUSTTStreamPlayer *retainSelfWhileClosing;
@property (nonatomic, strong) TVLManager *asyncClosingManager;
@end
@implementation FUSTTStreamPlayer
......@@ -155,28 +159,28 @@
}
- (void)fus_destroyPlayer {
[self fus_destroyPlayerAsync:YES];
[self fus_destroyPlayerAsync:NO];
}
- (void)fus_destroyPlayerAsync:(BOOL)async {
if (self.liveManager && !self.isAsyncClosing) {
TVLManager *manager = self.liveManager;
self.isAsyncClosing = YES;
@try {
if (self.liveManager.isPlaying
|| self.liveManager.playerLoadState == TVLPlayerLoadStateStalled
|| self.liveManager.playerLoadState == TVLPlayerLoadStatePlayable) {
[self.liveManager setMuted:YES];
if (manager.isPlaying
|| manager.playerLoadState == TVLPlayerLoadStateStalled
|| manager.playerLoadState == TVLPlayerLoadStatePlayable) {
[manager setMuted:YES];
}
[self.liveManager.playerView removeFromSuperview];
[manager.playerView removeFromSuperview];
if (async) {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[self.liveManager stop];
});
[self.liveManager closeAsync];
self.retainSelfWhileClosing = self;
self.asyncClosingManager = manager;
[manager closeAsync];
} else {
[self.liveManager stop];
[self.liveManager close];
[manager stop];
[manager close];
}
} @catch (NSException *exception) {
} @finally {
......@@ -186,6 +190,8 @@
_liveManager.delegate = nil;
_liveManager = nil;
self.isAsyncClosing = NO;
self.asyncClosingManager = nil;
self.retainSelfWhileClosing = nil;
}
}
}
......@@ -465,8 +471,12 @@
[self fus_removeKVOIfNeeded];
self.liveManager = nil;
}
if (manager == self.asyncClosingManager) {
self.asyncClosingManager = nil;
}
manager = nil;
self.isAsyncClosing = NO;
self.retainSelfWhileClosing = nil;
}
#pragma mark - VeLivePlayerObserver
......@@ -547,6 +557,7 @@
}
- (void)dealloc {
_liveManager.delegate = nil;
[self fus_removeKVOIfNeeded];
}
......
......@@ -691,7 +691,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_ENTITLEMENTS = FuSiLive/FuSiLive.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 202506260058;
CURRENT_PROJECT_VERSION = 202506260059;
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 = 202506260058;
CURRENT_PROJECT_VERSION = 202506260059;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO;
......
......@@ -1385,13 +1385,10 @@ static NSInteger const kFUSPayRoomCompanionPopViewTagLeft = 90917002;
viewModel.primaryButtonTitle = (diamondEnough ? [NSString fus_localString:@"进入陪伴"] : [NSString fus_localString:@"马上储值进入陪伴"]);
viewModel.trialButtonHidden = (previewTime <= 0);
if (previewTime > 0) {
viewModel.trialButtonTitle = [NSString stringWithFormat:[NSString fus_localString:@"试看%ldS"], (long)previewTime];
}
if (pricePerMinute > 0) {
viewModel.bottomTipText = (canCompanionTime > 0 ? [NSString stringWithFormat:[NSString fus_localString:@"您可陪伴%ld分钟,%ld/分钟"], (long)canCompanionTime, (long)pricePerMinute] : [NSString stringWithFormat:[NSString fus_localString:@"%ld/分钟"], (long)pricePerMinute]);
}
viewModel.bottomTipText = ([NSString stringWithFormat:[NSString fus_localString:@"您可陪伴%ld分钟,%ld/分钟"], (long)canCompanionTime, (long)pricePerMinute]);
return viewModel;
}
......
......@@ -85,29 +85,25 @@
BOOL isMute = [FUSLiveHelper fus_livePushMuteState];
NSString *muteStr = isMute ? [NSString fus_localString:@"打开麦克风"] : [NSString fus_localString:@"关闭麦克风"];
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:@"关闭麦克风"],
muteStr,
[NSString fus_localString:@"反转镜头"],
[NSString fus_localString:@"闪光关闭"],
[NSString fus_localString:@"镜像"],
[NSString fus_localString:@"贴纸"],
[NSString fus_localString:@"快捷发言"],
[NSString fus_localString:@"直播主题"],
[NSString fus_localString:@"礼物互动"]]
withImages:@[@"live_icon_cameraSetting",
[NSString fus_localString:@"直播主题"]]];
NSMutableArray *images = [NSMutableArray arrayWithArray:@[@"live_icon_cameraSetting",
@"live_setting_quality",
// @"live_setting_close_mic",
muteImgStr,
@"live_icon_changeCamera",
@"live_icon_turnOffLine",
@"live_setting_video_mirror",
@"live_setting_live_sticker",
@"live_setting_live_quickChat",
@"live_setting_live_theme",
@"live_setting_live_giftInteract"]
withTypes:@[@(FUSFaceBeautySetting),
@"live_setting_live_theme"]];
NSMutableArray *types = [NSMutableArray arrayWithArray:@[@(FUSFaceBeautySetting),
@(FUSLiveQuality),
@(FUSLiveCameraMic),
@(FUSFaceBeautychangeCamera),
......@@ -115,8 +111,15 @@
@(FUSLiveCameraMirror),
@(FUSLiveSetSticker),
@(FUSLiveEditQuickChat),
@(FUSLiveRoomTheme),
@(FUSLiveGiftInteract)]
@(FUSLiveRoomTheme)]];
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];
}else if(type == FUSShowFlashLineAndCamera){
......
......@@ -188,6 +188,9 @@
break;
case FUSLiveBottomToolTypeShowTime:
{
if (FUSConfig.sharedInstanced.devConfigs.appStatus) {
return;
}
if ([self.delegate respondsToSelector:@selector(fus_bottomSubView:didClickShowTimeOnView:)]) {
UIView *container = bgView ?: self.bgView ?: [UIViewController fus_topViewController].view;
[self.delegate fus_bottomSubView:self didClickShowTimeOnView:container];
......@@ -614,10 +617,18 @@
- (void)ffupdateToolView2TypesPKState:(FUSPKState)pkState {
NSMutableArray *toolTypesList = [[NSMutableArray alloc] init];
BOOL isReviewMode = FUSConfig.sharedInstanced.devConfigs.appStatus;
if (FUSLiveHelper.shareInstance.liveRoomType == FUSRoomTypeLinkMic) {
[toolTypesList appendObjects:@[@(FUSLiveBottomToolTypeLiveSetting),@(FUSLiveBottomToolTypeRoomSetting),@(FUSLiveBottomToolTypeShowTime)/*,@(FFLiveBottomToolTypeRoomScope), @(FFLiveBottomToolTypeNovaBuild)*/]];
[toolTypesList appendObjects:@[@(FUSLiveBottomToolTypeLiveSetting),@(FUSLiveBottomToolTypeRoomSetting)]];
if (!isReviewMode) {
[toolTypesList addObject:@(FUSLiveBottomToolTypeShowTime)];
}
} 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)]];
}
......
......@@ -217,11 +217,50 @@ import RxCocoa
// 对外一些方法
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]){
self.collectionItemList.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的顺序
for sectionType in self.sectionSequence {
......
......@@ -175,11 +175,11 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
FUSShowTimePaddingLabel *levLabel = [[FUSShowTimePaddingLabel alloc] init];
levLabel.textInsets = UIEdgeInsetsMake(0, 6, 0, 6);
levLabel.layer.cornerRadius = 9;
levLabel.layer.cornerRadius = 7;
levLabel.layer.masksToBounds = YES;
levLabel.backgroundColor = [UIColor colorWithWhite:1 alpha:0.9];
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.textAlignment = NSTextAlignmentCenter;
self.levLabel.text = @"0";
......@@ -323,26 +323,26 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
[self.levLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.topTitleLabel.mas_right).offset(4);
make.centerY.equalTo(self.topTitleLabel);
make.height.mas_equalTo(18);
make.height.equalTo(self.vipIconView.mas_height);
}];
[self.vipIconView mas_makeConstraints:^(MASConstraintMaker *make) {
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.width.mas_equalTo(0);
}];
[self.ticketIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.levLabel.mas_right).offset(35);
make.centerY.equalTo(self.topTicketInfoContainerView);
make.left.equalTo(self.vipIconView.mas_right).offset(12);
make.centerY.equalTo(self.avatarView);
make.size.mas_equalTo(CGSizeMake(23, 13.5));
make.right.lessThanOrEqualTo(self.topTicketInfoContainerView);
}];
[self.showTimeNewTicketLabel mas_makeConstraints:^(MASConstraintMaker *make) {
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.right.lessThanOrEqualTo(self.topTicketInfoContainerView);
}];
......@@ -398,12 +398,16 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
if (!self.progressLabel) {
self.progressLabel = [[UILabel alloc] init];
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.adjustsFontSizeToFitWidth = YES;
self.progressLabel.minimumScaleFactor = 0.7;
self.progressLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
self.progressLabel.allowsDefaultTighteningForTruncation = YES;
self.progressLabel.text = @"0%";
[self.progressContainer addSubview:self.progressLabel];
[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;
NSForegroundColorAttributeName: normalTextColor
}];
NSError *regexError = nil;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"(\\d+)\\/分钟" options:0 error:&regexError];
NSArray<NSTextCheckingResult *> *matches = (regexError ? @[] : [regex matchesInString:safeText options:0 range:NSMakeRange(0, safeText.length)]);
NSRange commaRange = [safeText rangeOfString:@"," options:NSBackwardsSearch];
if (commaRange.location == NSNotFound) {
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;
if (lastMatch && lastMatch.numberOfRanges > 1) {
NSRange digitRange = [lastMatch rangeAtIndex:1];
digitRange = [lastMatch rangeAtIndex:1];
}
}
if (digitRange.location != NSNotFound && NSMaxRange(digitRange) <= safeText.length) {
NSAttributedString *attachmentAttr = [NSAttributedString attributedStringWithAttachment:attachment];
NSAttributedString *spaceAttr = [[NSAttributedString alloc] initWithString:@" " attributes:@{
......@@ -402,7 +422,6 @@ static NSInteger const kFUSPayRoomEntryMainViewTag = 90917003;
[textAttr addAttribute:NSForegroundColorAttributeName value:jewelTextColor range:NSMakeRange(digitRange.location + 2, digitRange.length)];
}
}
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.alignment = NSTextAlignmentCenter;
......
......@@ -59,6 +59,7 @@ import FUSCommon
public var requestType: Int = 0
/// 普通嘉宾就是,0:公开,1:粉丝,2,私密 特别嘉宾就是 锁定类型:0:不锁定、1:付费、2:密码
public var scopeType = FUSLiveRoomScopeType.open
private var availableScopeTypes: [FUSLiveRoomScopeType] = []
let contentViewHeight = 312.0 + UIView.fus_SafeBottom()
let contentView = FUSPanGestureAlertView(frame: CGRectMake(0, 0, UIView.fus_screenW(), 312))
......@@ -118,48 +119,53 @@ import FUSCommon
make.bottom.equalToSuperview().offset(-(14 + UIView.fus_SafeBottom()))
}
let iconImagesList: [String]
let titlesList: [String]
let subTitlesList: [String]
if requestType == 0 {
iconImagesList = ["live_start_openScope_cell",
"live_start_passwordScope_cell",
"live_start_payScope_cell"]
titlesList = [String.fus_localString("公开屋"),
.fus_localString("私享屋"),
.fus_localString("付费屋")]
subTitlesList = [String.fus_localString("所有人可进入房间"),
.fus_localString("已关闭窗帘,玩家输入密码打开"),
.fus_localString("玩家需付费观看")]
} else {
iconImagesList = ["live_start_openScope_cell",
"live_start_passwordScope_cell",
"live_start_payScope_cell"]
titlesList = [String.fus_localString("公开屋"),
.fus_localString("私享屋"),
.fus_localString("付费屋")]
subTitlesList = [String.fus_localString("所有人可进入房间"),
.fus_localString("已关闭窗帘,玩家输入密码打开"),
.fus_localString("玩家需付费观看")]
struct ScopeItem {
let scopeType: FUSLiveRoomScopeType
let icon: String
let title: String
let subTitle: String
}
let isReviewMode = FUSConfig.sharedInstanced().devConfigs.appStatus
var scopeItems: [ScopeItem] = [
ScopeItem(scopeType: .open,
icon: "live_start_openScope_cell",
title: .fus_localString("公开屋"),
subTitle: .fus_localString("所有人可进入房间")),
ScopeItem(scopeType: .password,
icon: "live_start_passwordScope_cell",
title: .fus_localString("私享屋"),
subTitle: .fus_localString("已关闭窗帘,玩家输入密码打开"))
]
if !isReviewMode {
scopeItems.append(
ScopeItem(scopeType: .pay,
icon: "live_start_payScope_cell",
title: .fus_localString("付费屋"),
subTitle: .fus_localString("玩家需付费观看"))
)
}
self.availableScopeTypes = scopeItems.map { $0.scopeType }
if isReviewMode && self.scopeType == .pay {
self.scopeType = .open
}
let itemHeight = 56.0
privacyContentView.snp.makeConstraints { make in
make.left.right.equalToSuperview()
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()
for (index, iconStr) in iconImagesList.enumerated() {
for (index, item) in scopeItems.enumerated() {
var canSelect = true
if index == 0 {
if FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData?.liveScopeOpen.intValue == -1 {
canSelect = false
}
}
let itemView = FUSLiveStartSetPrivacyItemView.fus_create(icon: iconStr, title: titlesList[index], subTitle: subTitlesList[index], canSelect: canSelect)
if index == 2 {
let itemView = FUSLiveStartSetPrivacyItemView.fus_create(icon: item.icon, title: item.title, subTitle: item.subTitle, canSelect: canSelect)
if item.scopeType == .pay {
if let payData = FUSLiveHelper.shareInstance().liveBeforeReadyInfo?.payData,
(payData.enable ?? "0").intValue != 1 {
let warnSubTitle = payData.warnSubTitle ?? ""
......@@ -227,18 +233,22 @@ import FUSCommon
}
func fus_itemDidSelected(index: Int){
if index < 0 || index >= self.availableScopeTypes.count {
return
}
let selectedScopeType = self.availableScopeTypes[index]
switch index{
case 0:
switch selectedScopeType {
case .open:
if FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData?.liveScopeOpen.intValue == -1 {
self.scopeType = .password
} else {
self.scopeType = .open
}
case 1:
case .password:
self.scopeType = .password
case 2:
case .pay:
if let payData = FUSLiveHelper.shareInstance().liveBeforeReadyInfo?.payData { // 判断是否允许付费屋
if (payData.enable ?? "0").intValue != 1 {
let warnTitle = payData.warnTitle ?? ""
......@@ -257,8 +267,6 @@ import FUSCommon
self?.fus_itemDidSelected(index: index)
}
}
// case 2:
// self.scopeType = .intimacy
default:
break
}
......@@ -277,18 +285,10 @@ import FUSCommon
// 强化判断,不强依赖类型
func fus_getIndexWithScopeType() -> Int {
switch self.scopeType{
case .open:
return 0
case .password:
return 1
case .pay:
return 2
// case .intimacy:
// return 2
@unknown default:
return 0
if let index = self.availableScopeTypes.firstIndex(of: self.scopeType) {
return index
}
return 0
}
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