Commit bf9c8195 by suolong

修复部分bug问题

parent 67dd2891
Showing with 270 additions and 89 deletions
...@@ -3496,7 +3496,7 @@ ...@@ -3496,7 +3496,7 @@
"进入限时表演" = "进入限时表演"; "进入限时表演" = "进入限时表演";
"购票支持" = "购票支持"; "购票看秀" = "购票看秀";
"已集票数 %zd 张!" = "已集票数 %zd 张!"; "已集票数 %zd 张!" = "已集票数 %zd 张!";
...@@ -3582,7 +3582,7 @@ ...@@ -3582,7 +3582,7 @@
"陪伴中" = "陪伴中"; "陪伴中" = "陪伴中";
"试看中" = "试看中"; "试看中" = "试看中";
"本场收入:" = "本场收入:"; "本场收入:" = "本场收入:";
...@@ -3590,7 +3590,7 @@ ...@@ -3590,7 +3590,7 @@
"人" = "人"; "人" = "人";
"试看中:" = "试看中:"; "试看中:" = "试看中:";
"%zd人在陪伴" = "共有{0}人在陪伴"; "%zd人在陪伴" = "共有{0}人在陪伴";
......
...@@ -3496,7 +3496,8 @@ ...@@ -3496,7 +3496,8 @@
"进入限时表演" = "進入限時表演"; "进入限时表演" = "進入限時表演";
"购票支持" = "購票支持"; "购票看秀
" = "购票看秀";
"已集票数 %zd 张!" = "已集票數 %zd 張!"; "已集票数 %zd 张!" = "已集票數 %zd 張!";
......
...@@ -3434,7 +3434,7 @@ ...@@ -3434,7 +3434,7 @@
"进入陪伴" = "Enter to accompany"; "进入陪伴" = "Enter to accompany";
"马上储值进入陪伴" = "Instant recharge to join the companionship"; "马上储值进入陪伴" = "Recharge before entering";
"试看%ldS" = "Previewing %ldS"; "试看%ldS" = "Previewing %ldS";
...@@ -3490,13 +3490,13 @@ ...@@ -3490,13 +3490,13 @@
"玩家需付费观看" = "Players must pay to watch"; "玩家需付费观看" = "Players must pay to watch";
"抢当MVP" = "Grab the MVP"; "抢当MVP" = "Be MVP";
"支持主播" = "Support broadcaster"; "支持主播" = "Support broadcaster";
"进入限时表演" = "Enter Time-Limited Performance"; "进入限时表演" = "Enter performance";
"购票支持" = "Ticket Support"; "购票看秀" = "Buy tickets to watch the show";
"已集票数 %zd 张!" = "Number of tickets collected: %zd!"; "已集票数 %zd 张!" = "Number of tickets collected: %zd!";
...@@ -3514,7 +3514,7 @@ ...@@ -3514,7 +3514,7 @@
"已集票数 0 张!" = "Number of tickets collected: 0!"; "已集票数 0 张!" = "Number of tickets collected: 0!";
"取消集票" = "Cancel the ticket collection"; "取消集票" = "Cancel";
"表演中" = "Showing"; "表演中" = "Showing";
...@@ -3538,7 +3538,7 @@ ...@@ -3538,7 +3538,7 @@
"MVP持有张数" = "Number of MVP holdings"; "MVP持有张数" = "Number of MVP holdings";
"精彩限时表演中" = "Fantastic limited-time performance in progress"; "精彩限时表演中" = "Limited time performance";
"已集票数:" = "Number of tickets collected:"; "已集票数:" = "Number of tickets collected:";
...@@ -3558,9 +3558,9 @@ ...@@ -3558,9 +3558,9 @@
"最高%zd张" = "Highest %zd tickets"; "最高%zd张" = "Highest %zd tickets";
"票已集齐,请开始表演!" = "The tickets are all collected, please start the performance!"; "票已集齐,请开始表演!" = " Collection completed, start performing!";
"开始表演" = "Start the performance"; "开始表演" = "Start";
"确定取消表演?" = "Confirm cancel performance?"; "确定取消表演?" = "Confirm cancel performance?";
...@@ -3570,7 +3570,7 @@ ...@@ -3570,7 +3570,7 @@
"表演结束倒计时:--:--" = "Performance end countdown: --:--"; "表演结束倒计时:--:--" = "Performance end countdown: --:--";
"展示实力" = "Show your strength"; "展示实力" = "Donate her";
"表演结束倒计时:%02ld:%02ld" = "Performance end countdown: %02ld:%02ld"; "表演结束倒计时:%02ld:%02ld" = "Performance end countdown: %02ld:%02ld";
......
...@@ -3474,7 +3474,7 @@ ...@@ -3474,7 +3474,7 @@
"进入限时表演" = "時間限定のパフォーマンスに入る"; "进入限时表演" = "時間限定のパフォーマンスに入る";
"购票支持" = "チケットサポート"; "购票看秀" = "ショーを見るためにチケットを購入してください";
"已集票数 %zd 张!" = "集まった投票数: %zd!"; "已集票数 %zd 张!" = "集まった投票数: %zd!";
......
...@@ -3468,7 +3468,7 @@ ...@@ -3468,7 +3468,7 @@
"进入限时表演" = "เข้าสู่การแสดงจำกัดเวลา"; "进入限时表演" = "เข้าสู่การแสดงจำกัดเวลา";
"购票支持" = "สนับสนุนการซื้อตั๋ว"; "购票看秀" = "ซื้อตั๋วเพื่อดูรายการ";
"已集票数 %zd 张!" = "จำนวนคะแนนที่รวบรวม: %zd!"; "已集票数 %zd 张!" = "จำนวนคะแนนที่รวบรวม: %zd!";
......
...@@ -3474,7 +3474,7 @@ ...@@ -3474,7 +3474,7 @@
"进入限时表演" = "Vào biểu diễn hạn chế thời gian"; "进入限时表演" = "Vào biểu diễn hạn chế thời gian";
"购票支持" = "Hỗ trợ mua vé"; "购票看秀" = "Mua vé xem show";
"已集票数 %zd 张!" = "Số lượng phiếu đã thu thập: %zd!"; "已集票数 %zd 张!" = "Số lượng phiếu đã thu thập: %zd!";
......
...@@ -19,4 +19,11 @@ ...@@ -19,4 +19,11 @@
*/ */
+ (NSString *)stringWithObject:(id)obj; + (NSString *)stringWithObject:(id)obj;
/**
* 将字符串带➕号转成空
*/
+ (NSString *)stringAddFromNilWith:(NSString *)string;
@end @end
...@@ -26,4 +26,15 @@ ...@@ -26,4 +26,15 @@
return [NSString stringWithFormat:@"%@", obj]; return [NSString stringWithFormat:@"%@", obj];
} }
/**
* 将字符串带➕号转成空
*/
+ (NSString *)stringAddFromNilWith:(NSString *)string
{
if (string.length == 0) {
return @"";
}
NSString *normalizedText = [string stringByReplacingOccurrencesOfString:@"+" withString:@" "];
return normalizedText.stringByRemovingPercentEncoding ?: normalizedText;
}
@end @end
...@@ -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 = 202506260054; CURRENT_PROJECT_VERSION = 202506260056;
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 = 202506260054; CURRENT_PROJECT_VERSION = 202506260056;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC; DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO; ENABLE_ON_DEMAND_RESOURCES = NO;
......
...@@ -16,5 +16,21 @@ ...@@ -16,5 +16,21 @@
stopOnStyle = "0"> stopOnStyle = "0">
</BreakpointContent> </BreakpointContent>
</BreakpointProxy> </BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "562E8FF9-8048-4FA8-8F33-2E2ED25A75AB"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/View/FunctionView/ChatInputView/FUSLiveChatInputHelper.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "447"
endingLineNumber = "447"
landmarkName = "-fus_receiveTicketShowRealtimeDataNotification:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints> </Breakpoints>
</Bucket> </Bucket>
{
"images" : [
{
"filename" : "live_room_line.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "live_room_line@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "live_room_line@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -2557,8 +2557,12 @@ ...@@ -2557,8 +2557,12 @@
@"toLiveScope":@(toLiveScope)}; @"toLiveScope":@(toLiveScope)};
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_LIVE_CHANGE_Password params:params success:^(NSDictionary *dataDict, int code) { [FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_LIVE_CHANGE_Password params:params success:^(NSDictionary *dataDict, int code) {
[FUSLiveHelper shareInstance].roomScopeType = toLiveScope;
[FUSLiveHelper shareInstance].roomInfoModel.liveScope = toLiveScope;
if (cancel == 0) { if (cancel == 0) {
[FUSLiveHelper shareInstance].roomInfoModel.encryptionData.password = password; [FUSLiveHelper shareInstance].roomInfoModel.encryptionData.password = password;
} else {
[FUSLiveHelper shareInstance].roomInfoModel.encryptionData.password = @"";
} }
[[FUSLiveHelper shareInstance].currentFunctionView fus_startRecordLiveTimeWithTime:dataDict[@"livetime"]]; [[FUSLiveHelper shareInstance].currentFunctionView fus_startRecordLiveTimeWithTime:dataDict[@"livetime"]];
...@@ -3709,6 +3713,11 @@ ...@@ -3709,6 +3713,11 @@
@"toLiveScope":@(toLiveScope)}; @"toLiveScope":@(toLiveScope)};
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_liveChangePay params:parm success:^(NSDictionary * _Nullable dataDict, int code) { [FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_liveChangePay params:parm success:^(NSDictionary * _Nullable dataDict, int code) {
[FUSLiveHelper shareInstance].roomScopeType = toLiveScope;
[FUSLiveHelper shareInstance].roomInfoModel.liveScope = toLiveScope;
if ([cancel integerValue] == 1) {
[FUSLiveHelper shareInstance].roomInfoModel.roundId = @"";
}
if (succeed) { if (succeed) {
succeed(dataDict); succeed(dataDict);
} }
......
...@@ -665,7 +665,7 @@ static const CGFloat kFUSShowTimeAnchorQuickChatAvoidOffset = 45.0; ...@@ -665,7 +665,7 @@ static const CGFloat kFUSShowTimeAnchorQuickChatAvoidOffset = 45.0;
if (model.userBuyNum > 0 || (model.buyNum > 0 && ![NSString isNull:selfUid] && [buyUid isEqualToString:selfUid])) { if (model.userBuyNum > 0 || (model.buyNum > 0 && ![NSString isNull:selfUid] && [buyUid isEqualToString:selfUid])) {
self.showTimeAudienceDidBuyTicket = YES; self.showTimeAudienceDidBuyTicket = YES;
} }
NSString *actionTitle = (self.showTimeAudienceDidBuyTicket ? [NSString fus_localString:@"抢当MVP"] : [NSString fus_localString:@"购票支持"]); NSString *actionTitle = (self.showTimeAudienceDidBuyTicket ? [NSString fus_localString:@"抢当MVP"] : [NSString fus_localString:@"购票看秀"]);
bar.actionTitle = actionTitle; bar.actionTitle = actionTitle;
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
...@@ -1882,11 +1882,11 @@ static const CGFloat kFUSShowTimeAnchorQuickChatAvoidOffset = 45.0; ...@@ -1882,11 +1882,11 @@ static const CGFloat kFUSShowTimeAnchorQuickChatAvoidOffset = 45.0;
[self fus_bindShowTimeFrostedAvatarTapHandlerIfNeeded:bar]; [self fus_bindShowTimeFrostedAvatarTapHandlerIfNeeded:bar];
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAudience) { if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAudience) {
// 观众态:右侧按钮为“购票支持/抢当MVP”,不允许取消集票 // 观众态:右侧按钮为“购票看秀/抢当MVP”,不允许取消集票
bar.displayMode = FUSLiveShowTimeCollectFrostedDisplayModeAudience; bar.displayMode = FUSLiveShowTimeCollectFrostedDisplayModeAudience;
bar.cancelHandler = nil; bar.cancelHandler = nil;
bar.stageStatus = 0; bar.stageStatus = 0;
bar.actionTitle = [NSString fus_localString:@"购票支持"]; bar.actionTitle = [NSString fus_localString:@"购票看秀"];
__weak typeof(bar) weakBar = bar; __weak typeof(bar) weakBar = bar;
bar.actionHandler = ^{ bar.actionHandler = ^{
__strong typeof(weakSelf) strongSelf = weakSelf; __strong typeof(weakSelf) strongSelf = weakSelf;
...@@ -2048,7 +2048,7 @@ static const CGFloat kFUSShowTimeAnchorQuickChatAvoidOffset = 45.0; ...@@ -2048,7 +2048,7 @@ static const CGFloat kFUSShowTimeAnchorQuickChatAvoidOffset = 45.0;
if (model.userBuyNum > 0) { if (model.userBuyNum > 0) {
strongSelf.showTimeAudienceDidBuyTicket = YES; strongSelf.showTimeAudienceDidBuyTicket = YES;
} }
currentBar.actionTitle = (strongSelf.showTimeAudienceDidBuyTicket ? [NSString fus_localString:@"抢当MVP"] : [NSString fus_localString:@"购票支持"]); currentBar.actionTitle = (strongSelf.showTimeAudienceDidBuyTicket ? [NSString fus_localString:@"抢当MVP"] : [NSString fus_localString:@"购票看秀"]);
} else { } else {
currentBar.actionTitle = nil; currentBar.actionTitle = nil;
} }
......
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
[self.contentView addSubview:self.continueButton]; [self.contentView addSubview:self.continueButton];
self.confirmButton = [UIButton buttonWithType:UIButtonTypeCustom]; self.confirmButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.confirmButton.backgroundColor = [UIColor colorWithHex:@"#52DDE2"]; self.confirmButton.backgroundColor = [UIColor fus_themeColor];
self.confirmButton.layer.cornerRadius = buttonH / 2.0; self.confirmButton.layer.cornerRadius = buttonH / 2.0;
self.confirmButton.layer.masksToBounds = YES; self.confirmButton.layer.masksToBounds = YES;
[self.confirmButton setTitleColor:UIColor.blackColor forState:UIControlStateNormal]; [self.confirmButton setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
......
...@@ -104,7 +104,7 @@ typedef NS_ENUM(NSInteger, FUSLiveShowTimeCollectFrostedAvatarTapType) { ...@@ -104,7 +104,7 @@ typedef NS_ENUM(NSInteger, FUSLiveShowTimeCollectFrostedAvatarTapType) {
/// 用户端按钮点击回调(购票/抢当 MVP),仅 displayMode=Audience 时使用 /// 用户端按钮点击回调(购票/抢当 MVP),仅 displayMode=Audience 时使用
@property (nonatomic, copy, nullable) void (^actionHandler)(void); @property (nonatomic, copy, nullable) void (^actionHandler)(void);
/// 用户端按钮文案(如“购票支持”“抢当MVP”) /// 用户端按钮文案(如“购票看秀”“抢当MVP”)
@property (nonatomic, copy, nullable) NSString *actionTitle; @property (nonatomic, copy, nullable) NSString *actionTitle;
/// 阶段状态(来自服务端 stageData.showStatus,用于展示“表演中”等状态标签) /// 阶段状态(来自服务端 stageData.showStatus,用于展示“表演中”等状态标签)
......
...@@ -459,7 +459,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10; ...@@ -459,7 +459,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
// 功能:刷新主题、MVP/赠票用户展示、集票进度与剩余文案,并维护倒计时状态 // 功能:刷新主题、MVP/赠票用户展示、集票进度与剩余文案,并维护倒计时状态
NSString *decodedThemeText = nil; NSString *decodedThemeText = nil;
if (themeText.length > 0) { if (themeText.length > 0) {
decodedThemeText = themeText.stringByRemovingPercentEncoding ?: themeText; decodedThemeText = [NSString stringAddFromNilWith:themeText];
} }
NSString *finalThemeText = (decodedThemeText.length > 0 ? decodedThemeText : [NSString fus_localString:@"限时表演"]); NSString *finalThemeText = (decodedThemeText.length > 0 ? decodedThemeText : [NSString fus_localString:@"限时表演"]);
if (![self.themeLabel.text isEqualToString:finalThemeText]) { if (![self.themeLabel.text isEqualToString:finalThemeText]) {
...@@ -603,7 +603,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10; ...@@ -603,7 +603,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
- (void)fus_updateThemeText:(NSString *)themeText { - (void)fus_updateThemeText:(NSString *)themeText {
NSString *decodedThemeText = nil; NSString *decodedThemeText = nil;
if (themeText.length > 0) { if (themeText.length > 0) {
decodedThemeText = themeText.stringByRemovingPercentEncoding ?: themeText; decodedThemeText = [NSString stringAddFromNilWith:themeText];
} }
NSString *finalThemeText = (decodedThemeText.length > 0 ? decodedThemeText : [NSString fus_localString:@"限时表演"]); NSString *finalThemeText = (decodedThemeText.length > 0 ? decodedThemeText : [NSString fus_localString:@"限时表演"]);
if (![self.themeLabel.text isEqualToString:finalThemeText]) { if (![self.themeLabel.text isEqualToString:finalThemeText]) {
...@@ -710,7 +710,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10; ...@@ -710,7 +710,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
- (void)setActionTitle:(NSString *)actionTitle { - (void)setActionTitle:(NSString *)actionTitle {
_actionTitle = [actionTitle copy]; _actionTitle = [actionTitle copy];
// 功能:设置用户端按钮文案(购票支持/抢当MVP) // 功能:设置用户端按钮文案(购票看秀/抢当MVP)
if (self.displayMode == FUSLiveShowTimeCollectFrostedDisplayModeAudience && actionTitle.length > 0) { if (self.displayMode == FUSLiveShowTimeCollectFrostedDisplayModeAudience && actionTitle.length > 0) {
[self.cancelBtn setTitle:actionTitle forState:UIControlStateNormal]; [self.cancelBtn setTitle:actionTitle forState:UIControlStateNormal];
} }
...@@ -903,7 +903,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10; ...@@ -903,7 +903,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
[self.countdownIconView mas_remakeConstraints:^(MASConstraintMaker *make) { [self.countdownIconView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.remainingLabel.mas_right).offset(8); make.left.equalTo(self.remainingLabel.mas_right).offset(8);
make.centerY.equalTo(self.remainingLabel); make.centerY.equalTo(self.remainingLabel);
make.size.mas_equalTo(CGSizeMake(16, 16)); make.size.mas_equalTo(CGSizeMake(10, 10));
}]; }];
[self.countdownLabel mas_remakeConstraints:^(MASConstraintMaker *make) { [self.countdownLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
...@@ -928,7 +928,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10; ...@@ -928,7 +928,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
if (self.actionTitle.length > 0) { if (self.actionTitle.length > 0) {
[self.cancelBtn setTitle:self.actionTitle forState:UIControlStateNormal]; [self.cancelBtn setTitle:self.actionTitle forState:UIControlStateNormal];
} else { } else {
[self.cancelBtn setTitle:[NSString fus_localString:@"购票支持"] forState:UIControlStateNormal]; [self.cancelBtn setTitle:[NSString fus_localString:@"购票看秀"] forState:UIControlStateNormal];
} }
} else { } else {
showBtn = (self.cancelHandler != nil); showBtn = (self.cancelHandler != nil);
...@@ -938,7 +938,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10; ...@@ -938,7 +938,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60 * 10;
if (self.displayMode == FUSLiveShowTimeCollectFrostedDisplayModeAnchor) { if (self.displayMode == FUSLiveShowTimeCollectFrostedDisplayModeAnchor) {
showBtn = NO; showBtn = NO;
} else { } else {
// 观众端表演中保留入口(购票支持/抢当MVP) // 观众端表演中保留入口(购票看秀/抢当MVP)
showBtn = (self.actionHandler != nil || self.actionTitle.length > 0); showBtn = (self.actionHandler != nil || self.actionTitle.length > 0);
} }
} }
......
...@@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
/// 弹窗入口类型(用于默认选中项/顶部标识态) /// 弹窗入口类型(用于默认选中项/顶部标识态)
typedef NS_ENUM(NSInteger, FUSLiveShowTimeTicketActionEntryType) { typedef NS_ENUM(NSInteger, FUSLiveShowTimeTicketActionEntryType) {
/// 从“购票选秀/购票支持”入口进入 /// 从“购票选秀/购票看秀”入口进入
FUSLiveShowTimeTicketActionEntryTypeBuy = 1, FUSLiveShowTimeTicketActionEntryTypeBuy = 1,
/// 从“抢当MVP”入口进入 /// 从“抢当MVP”入口进入
FUSLiveShowTimeTicketActionEntryTypeGrabMVP = 2, FUSLiveShowTimeTicketActionEntryTypeGrabMVP = 2,
......
...@@ -299,6 +299,8 @@ ...@@ -299,6 +299,8 @@
@property (nonatomic, strong) FUSLiveShowTimeTicketContributionListView *contributionListView; @property (nonatomic, strong) FUSLiveShowTimeTicketContributionListView *contributionListView;
@property (nonatomic, strong) FUSLiveShowTimeTicketNoticeView *noticeView; @property (nonatomic, strong) FUSLiveShowTimeTicketNoticeView *noticeView;
@property (nonatomic, assign) NSInteger currentTabIndex; @property (nonatomic, assign) NSInteger currentTabIndex;
/// 是否已由用户手动选择购票类型(手动选择后不再覆盖默认选中)
@property (nonatomic, assign) BOOL didUserSelectOption;
/// 底部持有张数栏 /// 底部持有张数栏
@property (nonatomic, strong) UIView *bottomCountContainerView; @property (nonatomic, strong) UIView *bottomCountContainerView;
...@@ -358,6 +360,7 @@ ...@@ -358,6 +360,7 @@
self.mvpOwnedTicketCount = -1; self.mvpOwnedTicketCount = -1;
self.buyPrice = -1; self.buyPrice = -1;
self.currentTabIndex = 0; self.currentTabIndex = 0;
self.didUserSelectOption = NO;
self.bgBtn = [UIButton buttonWithType:UIButtonTypeCustom]; self.bgBtn = [UIButton buttonWithType:UIButtonTypeCustom];
self.bgBtn.backgroundColor = [UIColor colorWithWhite:0 alpha:0.35]; self.bgBtn.backgroundColor = [UIColor colorWithWhite:0 alpha:0.35];
...@@ -771,6 +774,7 @@ ...@@ -771,6 +774,7 @@
self.remainingTicketCount = remainingTicketCount; self.remainingTicketCount = remainingTicketCount;
self.mvpNeedTicketCount = mvpNeedTicketCount; self.mvpNeedTicketCount = mvpNeedTicketCount;
self.buyPrice = buyPrice; self.buyPrice = buyPrice;
[self fus_applyEntryTypeDefaultSelectionIfNeeded];
[self fus_applyCountsToOptionViews]; [self fus_applyCountsToOptionViews];
} }
...@@ -922,6 +926,22 @@ ...@@ -922,6 +926,22 @@
} }
} }
/// 按业务优先级设置默认选中:可直接开始时优先“直接开始”,否则“单张”;抢 MVP 入口固定“MVP所需”
- (void)fus_applyEntryTypeDefaultSelectionIfNeeded {
if (self.didUserSelectOption) {
return;
}
if (self.entryType == FUSLiveShowTimeTicketActionEntryTypeGrabMVP) {
self.selectedOption = FUSLiveShowTimeTicketPurchaseOptionMVPRequiredTickets;
return;
}
if (self.remainingTicketCount > 0) {
self.selectedOption = FUSLiveShowTimeTicketPurchaseOptionFillAllTickets;
} else {
self.selectedOption = FUSLiveShowTimeTicketPurchaseOptionOneTicket;
}
}
- (void)fus_applyOptionSelectedUI { - (void)fus_applyOptionSelectedUI {
[self.optionGroupView fus_setSelectedOption:self.selectedOption]; [self.optionGroupView fus_setSelectedOption:self.selectedOption];
} }
...@@ -934,6 +954,7 @@ ...@@ -934,6 +954,7 @@
if (![sender isKindOfClass:FUSLiveShowTimeTicketOptionCardView.class]) { if (![sender isKindOfClass:FUSLiveShowTimeTicketOptionCardView.class]) {
return; return;
} }
self.didUserSelectOption = YES;
self.selectedOption = (FUSLiveShowTimeTicketPurchaseOption)sender.tag; self.selectedOption = (FUSLiveShowTimeTicketPurchaseOption)sender.tag;
[self fus_applyOptionSelectedUI]; [self fus_applyOptionSelectedUI];
} }
......
...@@ -84,6 +84,7 @@ ...@@ -84,6 +84,7 @@
#import "FUSLinkMicroUserListView.h" #import "FUSLinkMicroUserListView.h"
#import "FUSLinkMicroListView.h" #import "FUSLinkMicroListView.h"
#import "FUSLinkMicroHttpHelper.h"
#import "FUSLiveEndChangeLinkMicModeView.h" #import "FUSLiveEndChangeLinkMicModeView.h"
...@@ -1458,7 +1459,7 @@ BDAlphaPlayerMetalViewDelegate ...@@ -1458,7 +1459,7 @@ BDAlphaPlayerMetalViewDelegate
if (!self.anchorPayRoomLeftView.superview) { if (!self.anchorPayRoomLeftView.superview) {
FusAnchorPayRoomView *leftView = [FusAnchorPayRoomView fus_createAnchorPayRoomViewIfNeeded]; FusAnchorPayRoomView *leftView = [FusAnchorPayRoomView fus_createAnchorPayRoomViewIfNeeded];
if (leftView) { if (leftView) {
leftView.y = weakSelf.pusherPopularView.bottom; leftView.y = weakSelf.pusherPopularView.bottom + 20;
weakSelf.anchorPayRoomLeftView = leftView; weakSelf.anchorPayRoomLeftView = leftView;
leftView.requestDataHandler = ^(BOOL force) { leftView.requestDataHandler = ^(BOOL force) {
[weakSelf fus_requestAnchorPayRoomDataWithForce:force]; [weakSelf fus_requestAnchorPayRoomDataWithForce:force];
...@@ -2170,6 +2171,8 @@ BDAlphaPlayerMetalViewDelegate ...@@ -2170,6 +2171,8 @@ BDAlphaPlayerMetalViewDelegate
MJWeakSelf MJWeakSelf
_linkMicroView.heightDidChangedHandler = ^(CGFloat height) { _linkMicroView.heightDidChangedHandler = ^(CGFloat height) {
weakSelf.linkMicroView.y = weakSelf.chatViewBgView.y - (height + 10); weakSelf.linkMicroView.y = weakSelf.chatViewBgView.y - (height + 10);
// 连麦列表高度变化时同步重排主题窗,避免遮挡连麦用户
[weakSelf fus_layoutLiveTopicWindow];
}; };
[_linkMicroView fus_setChannelId:FUSSwiftLiveHelper.shared.roomInfoModel.channelId roomId:FUSSwiftLiveHelper.shared.roomInfoModel.roomId]; [_linkMicroView fus_setChannelId:FUSSwiftLiveHelper.shared.roomInfoModel.channelId roomId:FUSSwiftLiveHelper.shared.roomInfoModel.roomId];
_linkMicroView.micListDelegate = self; _linkMicroView.micListDelegate = self;
...@@ -2859,10 +2862,29 @@ BDAlphaPlayerMetalViewDelegate ...@@ -2859,10 +2862,29 @@ BDAlphaPlayerMetalViewDelegate
CGFloat x = 8; CGFloat x = 8;
CGFloat maxWidth = self.width - 16; CGFloat maxWidth = self.width - 16;
CGSize size = [self.liveTopicWindowView fus_sizeThatFitsMaxWidth:maxWidth]; CGSize size = [self.liveTopicWindowView fus_sizeThatFitsMaxWidth:maxWidth];
// 默认贴底部工具栏上方
CGFloat y = self.bottomToolView.y - 6 - size.height; CGFloat y = self.bottomToolView.y - 6 - size.height;
if ([self fus_liveTopicWindowShouldAvoidLinkMicUsers]) {
// 有连麦用户时,主题窗上移到连麦列表上方
CGFloat topY = self.linkMicroView.y - 6 - size.height;
y = MIN(y, topY);
}
self.liveTopicWindowView.frame = CGRectMake(x, y, size.width, size.height); self.liveTopicWindowView.frame = CGRectMake(x, y, size.width, size.height);
} }
- (BOOL)fus_liveTopicWindowShouldAvoidLinkMicUsers {
if (!self.linkMicroView || self.linkMicroView.hidden) {
return NO;
}
// uid > 0 代表当前麦位有真实用户,需避让
for (FUSLinkMicroModel *model in self.linkMicroView.micListArr) {
if (model.uid.integerValue > 0) {
return YES;
}
}
return NO;
}
#pragma mark - Notification #pragma mark - Notification
/** /**
...@@ -7852,6 +7874,8 @@ BDAlphaPlayerMetalViewDelegate ...@@ -7852,6 +7874,8 @@ BDAlphaPlayerMetalViewDelegate
self.didRequestAnchorPayRoomData = NO; self.didRequestAnchorPayRoomData = NO;
self.isRequestingAnchorPayRoomData = NO; self.isRequestingAnchorPayRoomData = NO;
self.anchorPayRoomDataPayload = nil; self.anchorPayRoomDataPayload = nil;
// 切到私享屋时强制清理观众麦位,避免继续互听
[self fus_forceOffMicAudienceUsersIfNeeded];
[self fus_showPasswordAnim]; [self fus_showPasswordAnim];
break; break;
...@@ -7860,6 +7884,39 @@ BDAlphaPlayerMetalViewDelegate ...@@ -7860,6 +7884,39 @@ BDAlphaPlayerMetalViewDelegate
[self.bottomToolView fus_updateRoomScoreType]; [self.bottomToolView fus_updateRoomScoreType];
} }
- (void)fus_forceOffMicAudienceUsersIfNeeded {
// 仅主播侧处理:把除主播外的麦位用户全部下麦
if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAnchor) {
return;
}
if (!self.linkMicroView) {
return;
}
NSString *channelId = [NSString stringWithObject:FUSLiveHelper.shareInstance.roomInfoModel.channelId];
NSString *roomId = [NSString stringWithObject:FUSLiveHelper.shareInstance.roomInfoModel.roomId];
if ([NSString isNull:channelId] || [NSString isNull:roomId]) {
return;
}
NSString *anchorUid = roomId;
BOOL hasKickAction = NO;
for (FUSLinkMicroModel *model in self.linkMicroView.micListArr) {
NSString *uid = [NSString stringWithObject:model.uid];
if ([NSString isNull:uid] || uid.integerValue <= 0) {
continue;
}
// 主播本人不下麦
if ([uid isEqualToString:anchorUid]) {
continue;
}
hasKickAction = YES;
// 通知服务端将该观众移出麦位
[FUSLinkMicroHttpHelper fus_deleteLinkedMicroWithChannelId:channelId roomId:roomId toUserId:uid success:nil failure:nil];
}
if (hasKickAction) {
[self.linkMicroView requestOnlineData];
}
}
- (void)fus_showPasswordAnim { - (void)fus_showPasswordAnim {
if (self.passwordRoomIconImageView.superview) { if (self.passwordRoomIconImageView.superview) {
......
...@@ -166,7 +166,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen ...@@ -166,7 +166,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
- (void)layoutSubviews { - (void)layoutSubviews {
[super layoutSubviews]; [super layoutSubviews];
CGFloat headerH = 30; CGFloat headerH = 35;
CGFloat padding = 8; CGFloat padding = 8;
self.headerView.frame = CGRectMake(0, 0, CGRectGetWidth(self.bounds), headerH); self.headerView.frame = CGRectMake(0, 0, CGRectGetWidth(self.bounds), headerH);
......
...@@ -22,19 +22,12 @@ ...@@ -22,19 +22,12 @@
/// 右侧“消失”按钮列表(按 taskTexts 数量动态增减) /// 右侧“消失”按钮列表(按 taskTexts 数量动态增减)
@property (nonatomic, strong) NSMutableArray<UIButton *> *doneButtons; @property (nonatomic, strong) NSMutableArray<UIButton *> *doneButtons;
/// 分隔线列表(按 items 数量动态增减) /// 分隔线列表(按 items 数量动态增减)
@property (nonatomic, strong) NSMutableArray<UIView *> *separatorViews; @property (nonatomic, strong) NSMutableArray<UIImageView *> *separatorViews;
@end @end
@implementation FUSLiveGiftInteractTaskPanelView @implementation FUSLiveGiftInteractTaskPanelView
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];
}
- (instancetype)initWithFrame:(CGRect)frame { - (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
...@@ -104,7 +97,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen ...@@ -104,7 +97,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
} }
NSInteger separatorTargetCount = (targetCount > 0 ? (targetCount - 1) : 0); NSInteger separatorTargetCount = (targetCount > 0 ? (targetCount - 1) : 0);
while (self.separatorViews.count > separatorTargetCount) { while (self.separatorViews.count > separatorTargetCount) {
UIView *line = self.separatorViews.lastObject; UIImageView *line = self.separatorViews.lastObject;
[line removeFromSuperview]; [line removeFromSuperview];
[self.separatorViews removeLastObject]; [self.separatorViews removeLastObject];
} }
...@@ -143,8 +136,9 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen ...@@ -143,8 +136,9 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
[self.doneButtons addObject:btn]; [self.doneButtons addObject:btn];
} }
while (self.separatorViews.count < separatorTargetCount) { while (self.separatorViews.count < separatorTargetCount) {
UIView *line = [[UIView alloc] initWithFrame:CGRectZero]; UIImageView *line = [[UIImageView alloc] initWithFrame:CGRectZero];
line.backgroundColor = [UIColor colorWithWhite:1 alpha:0.15]; line.contentMode = UIViewContentModeScaleToFill;
line.image = [FUSShowRoomCenterBunble imageNamed:@"live_room_line"];
[self addSubview:line]; [self addSubview:line];
[self.separatorViews addObject:line]; [self.separatorViews addObject:line];
} }
...@@ -178,7 +172,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen ...@@ -178,7 +172,7 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
- (void)layoutSubviews { - (void)layoutSubviews {
[super layoutSubviews]; [super layoutSubviews];
CGFloat headerH = 30; CGFloat headerH = 35;
CGFloat padding = 8; CGFloat padding = 8;
CGFloat buttonSize = 18; CGFloat buttonSize = 18;
...@@ -202,46 +196,55 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen ...@@ -202,46 +196,55 @@ static NSString *fus_substringComposedToLength(NSString *text, NSUInteger maxLen
} }
self.emptyLabel.frame = CGRectZero; self.emptyLabel.frame = CGRectZero;
CGFloat avatarSize = 18; CGFloat lineGap = 1;
CGFloat rowGap = 6;
CGFloat availableH = CGRectGetHeight(self.bounds) - contentTop - padding * 2;
CGFloat totalGap = rowGap * MAX(0, self.items.count - 1);
CGFloat rowHeight = (availableH > totalGap ? ((availableH - totalGap) / self.items.count) : 0);
CGFloat nicknameH = ceil([UIFont fus_themeFont:9].lineHeight);
CGFloat taskH = ceil([UIFont fus_themeFont:10].lineHeight);
CGFloat textBlockH = nicknameH + lineGap + taskH;
CGFloat avatarSize = textBlockH;
CGFloat avatarX = padding; CGFloat avatarX = padding;
CGFloat avatarRight = avatarX + avatarSize + 4; CGFloat avatarRight = avatarX + avatarSize + 4;
CGFloat textX = avatarRight; CGFloat textX = avatarRight;
CGFloat buttonX = CGRectGetWidth(self.bounds) - padding - buttonSize; CGFloat buttonX = CGRectGetWidth(self.bounds) - padding - buttonSize;
CGFloat textW = buttonX - textX - 2; CGFloat textW = buttonX - textX - 2;
CGFloat lineGap = 1;
CGFloat rowGap = 6;
if (textW < 0) { if (textW < 0) {
textW = 0; textW = 0;
} }
CGFloat availableH = CGRectGetHeight(self.bounds) - contentTop - padding * 2;
CGFloat totalGap = rowGap * MAX(0, self.items.count - 1);
CGFloat rowHeight = (availableH > totalGap ? ((availableH - totalGap) / self.items.count) : 0);
for (NSInteger i = 0; i < self.items.count; i++) { for (NSInteger i = 0; i < self.items.count; i++) {
CGFloat y = contentTop + padding + i * (rowHeight + rowGap); CGFloat rowY = contentTop + padding + i * (rowHeight + rowGap);
CGFloat textTop = rowY + MAX(0, (rowHeight - textBlockH) * 0.5);
UIImageView *avatarView = self.avatarViews[i]; UIImageView *avatarView = self.avatarViews[i];
avatarView.frame = CGRectMake(avatarX, y + (rowHeight - avatarSize) * 0.5, avatarSize, avatarSize); avatarView.frame = CGRectMake(avatarX, textTop, avatarSize, avatarSize);
avatarView.layer.cornerRadius = avatarSize * 0.5; avatarView.layer.cornerRadius = avatarSize * 0.5;
CGFloat nicknameH = MIN(11, rowHeight * 0.45);
CGFloat taskH = MAX(0, rowHeight - nicknameH - lineGap);
UILabel *nicknameLabel = self.nicknameLabels[i]; UILabel *nicknameLabel = self.nicknameLabels[i];
nicknameLabel.frame = CGRectMake(textX, y, textW, nicknameH); nicknameLabel.frame = CGRectMake(textX, textTop, textW, nicknameH);
CBAutoScrollLabel *taskLabel = self.taskLabels[i]; CBAutoScrollLabel *taskLabel = self.taskLabels[i];
taskLabel.frame = CGRectMake(textX, CGRectGetMaxY(nicknameLabel.frame) + lineGap, textW, taskH); taskLabel.frame = CGRectMake(textX, CGRectGetMaxY(nicknameLabel.frame) + lineGap, textW, taskH);
UIButton *btn = self.doneButtons[i]; UIButton *btn = self.doneButtons[i];
btn.frame = CGRectMake(buttonX, y + (rowHeight - buttonSize) * 0.5, buttonSize, buttonSize); btn.frame = CGRectMake(buttonX, rowY + (rowHeight - buttonSize) * 0.5, buttonSize, buttonSize);
} }
CGFloat lineX = padding; CGFloat lineX = padding;
CGFloat lineW = CGRectGetWidth(self.bounds) - padding * 2; CGFloat lineW = CGRectGetWidth(self.bounds) - padding * 2;
CGFloat lineH = 0.5;
for (NSInteger i = 0; i < self.separatorViews.count; i++) { for (NSInteger i = 0; i < self.separatorViews.count; i++) {
UIImageView *line = self.separatorViews[i];
CGSize imageSize = line.image ? line.image.size : CGSizeZero;
CGFloat lineH = 1;
if (imageSize.width > 0 && imageSize.height > 0) {
lineH = MAX(1, floor(lineW * imageSize.height / imageSize.width));
}
CGFloat sepY = contentTop + padding + (i + 1) * rowHeight + i * rowGap + (rowGap - lineH) * 0.5; CGFloat sepY = contentTop + padding + (i + 1) * rowHeight + i * rowGap + (rowGap - lineH) * 0.5;
UIView *line = self.separatorViews[i];
line.frame = CGRectMake(lineX, sepY, lineW, lineH); line.frame = CGRectMake(lineX, sepY, lineW, lineH);
} }
} }
......
...@@ -48,7 +48,7 @@ static const CGFloat kFUSLiveTopicWindowInnerSpacing = 8.0; ...@@ -48,7 +48,7 @@ static const CGFloat kFUSLiveTopicWindowInnerSpacing = 8.0;
CGFloat bgWidth = MAX(0, CGRectGetMinX(self.arrowButton.frame)); CGFloat bgWidth = MAX(0, CGRectGetMinX(self.arrowButton.frame));
self.bgView.frame = CGRectMake(0, 0, bgWidth, self.bounds.size.height); self.bgView.frame = CGRectMake(0, 0, bgWidth, self.bounds.size.height);
self.bgView.layer.cornerRadius = 12; self.bgView.layer.cornerRadius = 7.5;
CGFloat x = kFUSLiveTopicWindowLeftPadding; CGFloat x = kFUSLiveTopicWindowLeftPadding;
self.topicIconView.frame = CGRectMake(x, (self.bounds.size.height - kFUSLiveTopicWindowIconSize) / 2.0, kFUSLiveTopicWindowIconSize, kFUSLiveTopicWindowIconSize); self.topicIconView.frame = CGRectMake(x, (self.bounds.size.height - kFUSLiveTopicWindowIconSize) / 2.0, kFUSLiveTopicWindowIconSize, kFUSLiveTopicWindowIconSize);
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
static CGFloat const kFUSPayRoomCompanionNormalHeight = 108.0; static CGFloat const kFUSPayRoomCompanionNormalHeight = 108.0;
static CGFloat const kFUSPayRoomCompanionRechargeDefaultHeight = 160.0; static CGFloat const kFUSPayRoomCompanionRechargeDefaultHeight = 160.0;
static CGFloat const kFUSPayRoomCompanionMinWidth = 120.0;
+ (FUSPayRoomCompanionPopView *)fus_showWithRootView:(UIView *)rootView + (FUSPayRoomCompanionPopView *)fus_showWithRootView:(UIView *)rootView
payRoomData:(FUSPayRoomFrostedGlassDataModel *)payRoomData payRoomData:(FUSPayRoomFrostedGlassDataModel *)payRoomData
...@@ -88,7 +89,15 @@ static CGFloat const kFUSPayRoomCompanionRechargeDefaultHeight = 160.0; ...@@ -88,7 +89,15 @@ static CGFloat const kFUSPayRoomCompanionRechargeDefaultHeight = 160.0;
[existView removeFromSuperview]; [existView removeFromSuperview];
} }
CGFloat viewW = 120; NSInteger canCompanionTime = MAX(0, displayCompanionData.canCompanionTime);
NSString *continueText = [NSString stringWithFormat:[NSString fus_localString:@"您可继续陪伴 %ld 分钟"], (long)canCompanionTime];
UIFont *continueFont = [UIFont fus_themeFont:8];
CGFloat continueTextW = ceil([continueText boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, 12)
options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading
attributes:@{NSFontAttributeName: continueFont}
context:nil].size.width);
CGFloat requiredContentW = continueTextW + 2 + 9 * 2;
CGFloat viewW = MAX(kFUSPayRoomCompanionMinWidth, requiredContentW + 14);
CGFloat viewH = (displayCompanionData.isEnough == 0 ? kFUSPayRoomCompanionRechargeDefaultHeight : kFUSPayRoomCompanionNormalHeight); CGFloat viewH = (displayCompanionData.isEnough == 0 ? kFUSPayRoomCompanionRechargeDefaultHeight : kFUSPayRoomCompanionNormalHeight);
CGFloat viewX = 10; CGFloat viewX = 10;
CGFloat viewY = UIView.fus_SafeTop + 205; CGFloat viewY = UIView.fus_SafeTop + 205;
......
...@@ -303,11 +303,11 @@ ...@@ -303,11 +303,11 @@
[self.trialButton mas_makeConstraints:^(MASConstraintMaker *make) { [self.trialButton mas_makeConstraints:^(MASConstraintMaker *make) {
self.trialButtonTopConstraint = make.top.equalTo(self.primaryButton.mas_bottom).offset(10); self.trialButtonTopConstraint = make.top.equalTo(self.primaryButton.mas_bottom).offset(10);
make.centerX.equalTo(self.cardView); make.centerX.equalTo(self.cardView);
self.trialButtonHeightConstraint = make.height.mas_equalTo(20); self.trialButtonHeightConstraint = make.height.mas_equalTo(18);
}]; }];
[self.trialButtonDividerView mas_makeConstraints:^(MASConstraintMaker *make) { [self.trialButtonDividerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.trialButton.mas_bottom).offset(5); make.top.equalTo(self.trialButton.mas_bottom).offset(-2);
make.centerX.equalTo(self.cardView); make.centerX.equalTo(self.cardView);
make.width.mas_equalTo(40); make.width.mas_equalTo(40);
self.trialButtonDividerHeightConstraint = make.height.mas_equalTo(1); self.trialButtonDividerHeightConstraint = make.height.mas_equalTo(1);
...@@ -332,7 +332,7 @@ ...@@ -332,7 +332,7 @@
- (void)fus_updateTrialButtonHidden:(BOOL)hidden { - (void)fus_updateTrialButtonHidden:(BOOL)hidden {
self.trialButton.hidden = hidden; self.trialButton.hidden = hidden;
self.trialButton.userInteractionEnabled = !hidden; self.trialButton.userInteractionEnabled = !hidden;
[self.trialButtonHeightConstraint setOffset:(hidden ? 0 : 20)]; [self.trialButtonHeightConstraint setOffset:(hidden ? 0 : 18)];
[self.trialButtonTopConstraint setOffset:(hidden ? 0 : 10)]; [self.trialButtonTopConstraint setOffset:(hidden ? 0 : 10)];
self.trialButtonDividerView.hidden = hidden; self.trialButtonDividerView.hidden = hidden;
......
...@@ -314,11 +314,12 @@ import FUSCommon ...@@ -314,11 +314,12 @@ import FUSCommon
/// - 注意: /// - 注意:
/// - “付费屋 → 公开屋”不调用该接口(由 /live/change/pay(cancel=1) 撤销付费并回到公开) /// - “付费屋 → 公开屋”不调用该接口(由 /live/change/pay(cancel=1) 撤销付费并回到公开)
/// - “付费屋 → 私享屋”需先撤销付费,再进入设置密码流程 /// - “付费屋 → 私享屋”需先撤销付费,再进入设置密码流程
private func fus_changeScopeRequest(scopeType: FUSLiveRoomScopeType, password:String) { private func fus_changeScopeRequest(scopeType: FUSLiveRoomScopeType, password:String, fromScopeType: FUSLiveRoomScopeType? = nil) {
guard let roomID = FUSLiveHelper.shareInstance().roomInfoModel?.roomId else { return } guard let roomID = FUSLiveHelper.shareInstance().roomInfoModel?.roomId else { return }
let fromLiveScope = FUSLiveHelper.shareInstance().roomScopeType.rawValue let realFromScopeType = fromScopeType ?? FUSLiveHelper.shareInstance().roomScopeType
let toLiveScope = scopeType.rawValue let fromLiveScope = fus_scopeValue(realFromScopeType)
let toLiveScope = fus_scopeValue(scopeType)
// FUSIndicator.showProgress(withMessage: "") // FUSIndicator.showProgress(withMessage: "")
FUSLoadingIndicator.fus_show(canTouch: true) FUSLoadingIndicator.fus_show(canTouch: true)
...@@ -329,6 +330,9 @@ import FUSCommon ...@@ -329,6 +330,9 @@ import FUSCommon
// FUSIndicator.dismissProgress() // FUSIndicator.dismissProgress()
FUSLoadingIndicator.fus_dismiss() FUSLoadingIndicator.fus_dismiss()
if scopeType == .open {
FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData?.password = ""
}
FUSLiveHelper.shareInstance().roomScopeType = scopeType FUSLiveHelper.shareInstance().roomScopeType = scopeType
FUSLiveHelper.shareInstance().currentFunctionView?.fus_updateRoomScoreType() FUSLiveHelper.shareInstance().currentFunctionView?.fus_updateRoomScoreType()
// switch scopeType{ // switch scopeType{
...@@ -373,7 +377,7 @@ import FUSCommon ...@@ -373,7 +377,7 @@ import FUSCommon
/// - 若当前非“付费屋”,走密码接口取消私享(如有)恢复公开 /// - 若当前非“付费屋”,走密码接口取消私享(如有)恢复公开
private func fus_changeToOpenScopeRequest() { private func fus_changeToOpenScopeRequest() {
if FUSLiveHelper.shareInstance().roomScopeType == .pay { if FUSLiveHelper.shareInstance().roomScopeType == .pay {
self.fus_requestChangePay(cancel: true) { [weak self] succeed in self.fus_requestChangePay(cancel: true, targetScopeType: .open, fromScopeType: .pay) { [weak self] succeed in
guard let self = self else { return } guard let self = self else { return }
if !succeed { if !succeed {
return return
...@@ -389,7 +393,7 @@ import FUSCommon ...@@ -389,7 +393,7 @@ import FUSCommon
private func fus_prepareToChangePasswordScope() { private func fus_prepareToChangePasswordScope() {
if FUSLiveHelper.shareInstance().roomScopeType == .pay { if FUSLiveHelper.shareInstance().roomScopeType == .pay {
self.fus_requestChangePay(cancel: true) { [weak self] succeed in self.fus_requestChangePay(cancel: true, targetScopeType: .password, fromScopeType: .pay) { [weak self] succeed in
guard let self = self else { return } guard let self = self else { return }
if !succeed { if !succeed {
UIView.animate(withDuration: 0.25) { UIView.animate(withDuration: 0.25) {
...@@ -397,18 +401,18 @@ import FUSCommon ...@@ -397,18 +401,18 @@ import FUSCommon
} }
return return
} }
self.fus_showPasswordSettingView() self.fus_showPasswordSettingView(fromScopeType: .pay)
} }
} else { } else {
self.fus_showPasswordSettingView() self.fus_showPasswordSettingView()
} }
} }
private func fus_showPasswordSettingView() { private func fus_showPasswordSettingView(fromScopeType: FUSLiveRoomScopeType? = nil) {
FUSLiveStartSetPasswordView.fus_create(clickHandler: { [weak self] succeed, password in FUSLiveStartSetPasswordView.fus_create(clickHandler: { [weak self] succeed, password in
guard let self = self else { return } guard let self = self else { return }
if succeed { if succeed {
self.fus_changeScopeRequest(scopeType: self.scopeType, password: password) self.fus_changeScopeRequest(scopeType: self.scopeType, password: password, fromScopeType: fromScopeType)
} else { } else {
UIView.animate(withDuration: 0.25) { UIView.animate(withDuration: 0.25) {
self.contentView.frame = CGRectMake(0, UIView.fus_screenH() - self.contentViewHeight, UIView.fus_screenW(), self.contentViewHeight) self.contentView.frame = CGRectMake(0, UIView.fus_screenH() - self.contentViewHeight, UIView.fus_screenW(), self.contentViewHeight)
...@@ -424,12 +428,12 @@ import FUSCommon ...@@ -424,12 +428,12 @@ import FUSCommon
} }
if FUSLiveHelper.shareInstance().roomScopeType == .password { if FUSLiveHelper.shareInstance().roomScopeType == .password {
self.fus_requestCancelPassword { [weak self] succeed in self.fus_requestCancelPassword(targetScopeType: .pay, fromScopeType: .password) { [weak self] succeed in
guard let self = self else { return } guard let self = self else { return }
if !succeed { if !succeed {
return return
} }
self.fus_requestChangePay(cancel: false, completion: nil) self.fus_requestChangePay(cancel: false, targetScopeType: .pay, fromScopeType: .password, completion: nil)
} }
} else { } else {
self.fus_requestChangePay(cancel: false, completion: nil) self.fus_requestChangePay(cancel: false, completion: nil)
...@@ -439,18 +443,20 @@ import FUSCommon ...@@ -439,18 +443,20 @@ import FUSCommon
/// 取消“私享屋”(密码房) /// 取消“私享屋”(密码房)
/// - 用途:用于“私享屋 → 公开屋”或“私享屋 → 付费屋”前的取消操作 /// - 用途:用于“私享屋 → 公开屋”或“私享屋 → 付费屋”前的取消操作
/// - 注意:“付费屋 → 公开屋”不调用该接口,由 /live/change/pay(cancel=1) 撤销付费 /// - 注意:“付费屋 → 公开屋”不调用该接口,由 /live/change/pay(cancel=1) 撤销付费
private func fus_requestCancelPassword(completion: @escaping (Bool) -> Void) { private func fus_requestCancelPassword(targetScopeType: FUSLiveRoomScopeType = .open, fromScopeType: FUSLiveRoomScopeType? = nil, completion: @escaping (Bool) -> Void) {
guard let roomID = FUSLiveHelper.shareInstance().roomInfoModel?.roomId else { guard let roomID = FUSLiveHelper.shareInstance().roomInfoModel?.roomId else {
completion(false) completion(false)
return return
} }
let fromLiveScope = FUSLiveHelper.shareInstance().roomScopeType.rawValue let realFromScopeType = fromScopeType ?? FUSLiveHelper.shareInstance().roomScopeType
let toLiveScope = FUSLiveRoomScopeType.open.rawValue let fromLiveScope = fus_scopeValue(realFromScopeType)
let toLiveScope = fus_scopeValue(targetScopeType)
FUSLoadingIndicator.fus_show(canTouch: true) FUSLoadingIndicator.fus_show(canTouch: true)
FUSLiveHttpHelper.fus_requestChangedPassword(1, fid: roomID.intValue, fromLiveScope: fromLiveScope, toLiveScope: toLiveScope, password: "", success: { FUSLiveHttpHelper.fus_requestChangedPassword(1, fid: roomID.intValue, fromLiveScope: fromLiveScope, toLiveScope: toLiveScope, password: "", success: {
FUSLoadingIndicator.fus_dismiss() FUSLoadingIndicator.fus_dismiss()
FUSLiveHelper.shareInstance().roomScopeType = .open FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData?.password = ""
FUSLiveHelper.shareInstance().roomScopeType = targetScopeType
FUSLiveHelper.shareInstance().currentFunctionView?.fus_updateRoomScoreType() FUSLiveHelper.shareInstance().currentFunctionView?.fus_updateRoomScoreType()
completion(true) completion(true)
}, failure: { msg, code in }, failure: { msg, code in
...@@ -469,14 +475,16 @@ import FUSCommon ...@@ -469,14 +475,16 @@ import FUSCommon
/// - cancel == "0":同步 roundId(付费回合ID),设置 .pay 并刷新 UI /// - cancel == "0":同步 roundId(付费回合ID),设置 .pay 并刷新 UI
/// - cancel == "1":清空 roundId,设置 .open 并刷新 UI /// - cancel == "1":清空 roundId,设置 .open 并刷新 UI
/// - 注意:“付费屋 → 私享屋”需先撤销付费(cancel=1),再进入密码流程 /// - 注意:“付费屋 → 私享屋”需先撤销付费(cancel=1),再进入密码流程
private func fus_requestChangePay(cancel: Bool, completion: ((Bool) -> Void)?) { private func fus_requestChangePay(cancel: Bool, targetScopeType: FUSLiveRoomScopeType = .open, fromScopeType: FUSLiveRoomScopeType? = nil, completion: ((Bool) -> Void)?) {
guard let uid = FUSCacheDataShare.shareStore().userDetailInfo.uid, guard let uid = FUSCacheDataShare.shareStore().userDetailInfo.uid,
let fid = FUSLiveHelper.shareInstance().roomInfoModel?.roomId else { let fid = FUSLiveHelper.shareInstance().roomInfoModel?.roomId else {
completion?(false) completion?(false)
return return
} }
let fromLiveScope = FUSLiveHelper.shareInstance().roomScopeType.rawValue let targetScope = (cancel ? targetScopeType : .pay)
let toLiveScope = (cancel ? FUSLiveRoomScopeType.open.rawValue : FUSLiveRoomScopeType.pay.rawValue) let realFromScopeType = fromScopeType ?? FUSLiveHelper.shareInstance().roomScopeType
let fromLiveScope = fus_scopeValue(realFromScopeType)
let toLiveScope = fus_scopeValue(targetScope)
FUSLoadingIndicator.fus_show(canTouch: true) FUSLoadingIndicator.fus_show(canTouch: true)
FUSLiveHttpHelper.fus_requestLiveChangePay(withUid: uid, fid: fid, cancel: cancel ? "1" : "0", fromLiveScope: fromLiveScope, toLiveScope: toLiveScope, succeed: { [weak self] dataDict in FUSLiveHttpHelper.fus_requestLiveChangePay(withUid: uid, fid: fid, cancel: cancel ? "1" : "0", fromLiveScope: fromLiveScope, toLiveScope: toLiveScope, succeed: { [weak self] dataDict in
...@@ -487,7 +495,10 @@ import FUSCommon ...@@ -487,7 +495,10 @@ import FUSCommon
if cancel { if cancel {
FUSLiveHelper.shareInstance().roomInfoModel?.roundId = "" FUSLiveHelper.shareInstance().roomInfoModel?.roundId = ""
FUSSwiftLiveHelper.shared.roomInfoModel?.roundId = "" FUSSwiftLiveHelper.shared.roomInfoModel?.roundId = ""
FUSLiveHelper.shareInstance().roomScopeType = .open if targetScope == .open {
FUSLiveHelper.shareInstance().roomInfoModel?.encryptionData?.password = ""
}
FUSLiveHelper.shareInstance().roomScopeType = targetScope
FUSLiveHelper.shareInstance().currentFunctionView?.fus_updateRoomScoreType() FUSLiveHelper.shareInstance().currentFunctionView?.fus_updateRoomScoreType()
completion?(true) completion?(true)
return return
...@@ -516,6 +527,19 @@ import FUSCommon ...@@ -516,6 +527,19 @@ import FUSCommon
completion?(false) completion?(false)
}) })
} }
private func fus_scopeValue(_ scopeType: FUSLiveRoomScopeType) -> Int {
switch scopeType {
case .open:
return 0
case .pay:
return 3
case .password:
return 4
@unknown default:
return scopeType.rawValue
}
}
} }
......
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