Commit f766ee8e by suolong

提交修改部分bug

parent 4308636e
Showing with 473 additions and 60 deletions
...@@ -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 = 202506260048; CURRENT_PROJECT_VERSION = 202506260050;
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 = 202506260048; CURRENT_PROJECT_VERSION = 202506260050;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 6GG26BHUMC; DEVELOPMENT_TEAM = 6GG26BHUMC;
ENABLE_ON_DEMAND_RESOURCES = NO; ENABLE_ON_DEMAND_RESOURCES = NO;
......
{
"images" : [
{
"filename" : "Live_botton_payIn.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Live_botton_payIn@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Live_botton_payIn@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "Live_room_showTime.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Live_room_showTime@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Live_room_showTime@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -391,7 +391,7 @@ ...@@ -391,7 +391,7 @@
return; return;
} }
if (!self.selectedGift || self.giftLabel.text.length == 0) { if (!self.selectedGift || self.giftLabel.text.length == 0) {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"请选择礼物"]]; [FUSDialogView fus_showDialog:[NSString fus_localString:@"请绑定互动礼物"]];
return; return;
} }
if (self.count <= 0) { if (self.count <= 0) {
...@@ -458,4 +458,29 @@ ...@@ -458,4 +458,29 @@
[self fus_hideGiftDropdown]; [self fus_hideGiftDropdown];
} }
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if (textField != self.descField) {
return YES;
}
if (string.length == 0) {
return YES;
}
NSString *originText = textField.text ?: @"";
if (range.location > originText.length) {
return YES;
}
NSString *nextText = [originText stringByReplacingCharactersInRange:range withString:(string ?: @"")];
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^[A-Za-z\\u4e00-\\u9fa5\\s]*$" options:0 error:nil];
NSUInteger matchCount = [regex numberOfMatchesInString:nextText options:0 range:NSMakeRange(0, nextText.length)];
if (matchCount == 0) {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"仅限中文、英文、空格"]];
return NO;
}
if (nextText.length <= 6) {
return YES;
}
[FUSDialogView fus_showDialog:[NSString fus_localString:@"互动描述过长,请重新输入"]];
return NO;
}
@end @end
...@@ -86,6 +86,11 @@ static NSInteger const FUSLiveGiftInteractMaxItemCount = 20; ...@@ -86,6 +86,11 @@ static NSInteger const FUSLiveGiftInteractMaxItemCount = 20;
- (void)fus_onGiftInteractSwitchChanged:(BOOL)isOn cell:(FUSLiveGiftInteractSettingEnableCell *)cell { - (void)fus_onGiftInteractSwitchChanged:(BOOL)isOn cell:(FUSLiveGiftInteractSettingEnableCell *)cell {
BOOL previous = self.isEnabled; BOOL previous = self.isEnabled;
if (isOn && [self fus_activeGiftInteractItemCount] == 0) {
[cell fus_setupWithEnabled:previous];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"请至少添加或激活一种互动选项"]];
return;
}
self.isEnabled = isOn; self.isEnabled = isOn;
[cell fus_setSwitchUserInteractionEnabled:NO]; [cell fus_setSwitchUserInteractionEnabled:NO];
...@@ -108,6 +113,16 @@ static NSInteger const FUSLiveGiftInteractMaxItemCount = 20; ...@@ -108,6 +113,16 @@ static NSInteger const FUSLiveGiftInteractMaxItemCount = 20;
}]; }];
} }
- (NSInteger)fus_activeGiftInteractItemCount {
NSInteger count = 0;
for (FUSLiveGiftInteractSettingItemModel *item in self.items) {
if (item.status == 1) {
count += 1;
}
}
return count;
}
- (void)onClickAdd { - (void)onClickAdd {
if (self.items.count >= FUSLiveGiftInteractMaxItemCount) { if (self.items.count >= FUSLiveGiftInteractMaxItemCount) {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"互动内容数量已达上限"]]; [FUSDialogView fus_showDialog:[NSString fus_localString:@"互动内容数量已达上限"]];
...@@ -197,6 +212,11 @@ static NSInteger const FUSLiveGiftInteractMaxItemCount = 20; ...@@ -197,6 +212,11 @@ static NSInteger const FUSLiveGiftInteractMaxItemCount = 20;
return; return;
} }
FUSLiveGiftInteractSettingItemModel *item = self.items[index]; FUSLiveGiftInteractSettingItemModel *item = self.items[index];
if (!isOn && self.isEnabled && item.status == 1 && [self fus_activeGiftInteractItemCount] <= 1) {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"请至少添加或激活一种互动选项"]];
[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:index inSection:1]] withRowAnimation:UITableViewRowAnimationNone];
return;
}
NSString *uid = FUSCacheDataShare.shareStore.userDetailInfo.uid ?: @""; NSString *uid = FUSCacheDataShare.shareStore.userDetailInfo.uid ?: @"";
NSString *roomId = [FUSLiveHelper shareInstance].roomInfoModel.roomId ?: @""; NSString *roomId = [FUSLiveHelper shareInstance].roomInfoModel.roomId ?: @"";
NSString *channelId = [FUSLiveHelper shareInstance].roomInfoModel.channelId ?: @""; NSString *channelId = [FUSLiveHelper shareInstance].roomInfoModel.channelId ?: @"";
......
...@@ -1603,14 +1603,26 @@ typedef NS_ENUM(NSInteger, FUSStreamState) { ...@@ -1603,14 +1603,26 @@ typedef NS_ENUM(NSInteger, FUSStreamState) {
- (void)forceKick:(NSNotification *)noti { - (void)forceKick:(NSNotification *)noti {
FUSSocketMessageModel *messageModel = noti.object; FUSSocketMessageModel *messageModel = noti.object;
NSDictionary *dict = [messageModel fus_getJsonDict]; NSDictionary *dict = [messageModel fus_getJsonDict];
NSInteger exitType = [dict[@"exitType"] integerValue];
if ([dict[@"exitType"] integerValue] == 1) { if (exitType == 1) {
NSString *roomId = [FUSLiveHelper shareInstance].roomInfoModel.roomId; NSString *roomId = [FUSLiveHelper shareInstance].roomInfoModel.roomId;
[[FUSLiveHelper shareInstance] fus_endPayRoomPreviewWithRoomId:roomId]; [[FUSLiveHelper shareInstance] fus_endPayRoomPreviewWithRoomId:roomId];
[FUSDialogView fus_showDialog:[FUSFormatContentHelper fus_getContentFromArr:dict[@"multiContents"]]]; [FUSDialogView fus_showDialog:[FUSFormatContentHelper fus_getContentFromArr:dict[@"multiContents"]]];
return; return;
} }
if (exitType == 2) {
if ([FUSLiveHelper shareInstance].liveType == FUSLiveTypeAudience) {
NSString *roomId = [FUSLiveHelper shareInstance].roomInfoModel.roomId;
NSString *channelId = [[dict[@"channelId"] description] length] ? [dict[@"channelId"] description] : [FUSLiveHelper shareInstance].roomInfoModel.channelId;
NSString *roundId = [[dict[@"roundId"] description] length] ? [dict[@"roundId"] description] : [FUSLiveHelper shareInstance].roomInfoModel.roundId;
NSString *tipText = [FUSFormatContentHelper fus_getContentFromArr:dict[@"multiContents"]];
[[FUSLiveHelper shareInstance] fus_handleShowTimeKickToBuyEntryWithRoomId:(roomId ?: @"") channelId:(channelId ?: @"") roundId:(roundId ?: @"") tipText:(tipText ?: @"")];
return;
}
}
if ([[FUSLiveHelper shareInstance] liveType] == FUSLiveTypeAudience) { if ([[FUSLiveHelper shareInstance] liveType] == FUSLiveTypeAudience) {
// 播放 // 播放
[_streamView.playView fus_stopALLPlayer]; [_streamView.playView fus_stopALLPlayer];
......
...@@ -280,6 +280,12 @@ typedef NS_ENUM(NSInteger,FUSLiveRoomScopeType) { ...@@ -280,6 +280,12 @@ typedef NS_ENUM(NSInteger,FUSLiveRoomScopeType) {
/// 付费房模式切到非付费(mode=0):恢复正常UI并重置播放 /// 付费房模式切到非付费(mode=0):恢复正常UI并重置播放
- (void)fus_handlePayRoomSwitchToNormalPlayWithRoomId:(NSString *)roomId; - (void)fus_handlePayRoomSwitchToNormalPlayWithRoomId:(NSString *)roomId;
/// 限时表演房被踢出后统一处理:停播并隐藏直播层,展示购票入口页
- (void)fus_handleShowTimeKickToBuyEntryWithRoomId:(NSString *)roomId
channelId:(NSString *)channelId
roundId:(NSString *)roundId
tipText:(NSString *)tipText;
// 最小化直播间 // 最小化直播间
+ (void)fus_minimizeLiveCompletion: (void (^ __nullable)(void))completion; + (void)fus_minimizeLiveCompletion: (void (^ __nullable)(void))completion;
......
...@@ -1074,6 +1074,65 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor ...@@ -1074,6 +1074,65 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
[self fus_requestTicketShowBuyGetDataAndFillEntry:entry roomId:roomId channelId:channelId roundId:roundId completion:nil]; [self fus_requestTicketShowBuyGetDataAndFillEntry:entry roomId:roomId channelId:channelId roundId:roundId completion:nil];
} }
- (void)fus_handleShowTimeKickToBuyEntryWithRoomId:(NSString *)roomId
channelId:(NSString *)channelId
roundId:(NSString *)roundId
tipText:(NSString *)tipText
{
dispatch_async(dispatch_get_main_queue(), ^{
NSString *currentRoomId = ([NSString isNull:roomId] ? (self.roomInfoModel.roomId ?: @"") : roomId);
NSString *safeChannelId = ([NSString isNull:channelId] ? (self.roomInfoModel.channelId ?: @"") : channelId);
NSString *safeRoundId = ([NSString isNull:roundId] ? (self.roomInfoModel.roundId ?: @"") : roundId);
FUSStreamPlayStatus status = [self.liveVC.playView fus_statusForUID:currentRoomId];
if (status == FUSStreamPlayStatusPlaying
|| status == FUSStreamPlayStatusLoading
|| status == FUSStreamPlayStatusPause) {
[self.liveVC.playView fus_stopWithUID:currentRoomId];
[self.liveVC.playView fus_destroyAllPlayer];
[self.liveVC fus_stopPlay];
[self.liveVC destroyPlayPictureInPicture];
}
UIView *rootView = self.liveVC.view ?: [UIViewController fus_topViewController].view;
[self.liveVC fus_setupScrollEnable:NO];
self.liveVC.backgroundImageView.hidden = YES;
[self.currentFunctionView fus_hideAllFunctionLayers];
self.liveVC.liveFunctionView.hidden = YES;
__weak typeof(self) weakSelf = self;
__block FUSTicketShowCollectTicketToggleResultModel *buyGetDataModel = nil;
__block __weak FUSLiveShowTimeAudienceEntryMainView *weakEntryView = nil;
FUSLiveShowTimeAudienceEntryMainView *entry = [FUSLiveShowTimeAudienceEntryMainView fus_showOnView:rootView actionHandler:^(FUSLiveShowTimeAudienceEntryMainViewAction action, NSInteger selectedOptionIndex) {
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
if (action == FUSLiveShowTimeAudienceEntryMainViewActionDismiss) {
[FUSLiveHelper fus_quitLiveWithCompletion:nil];
return;
}
if (action == FUSLiveShowTimeAudienceEntryMainViewActionEnter) {
if (!buyGetDataModel) {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"数据加载中,请稍后"]];
return;
}
NSInteger buyNum = [strongSelf fus_ticketShowBuyNumWithBuyGetDataModel:buyGetDataModel selectedOptionIndex:selectedOptionIndex];
[strongSelf fus_requestTicketShowUserBuyAndEnterRoomWithRoomId:currentRoomId channelId:safeChannelId roundId:safeRoundId buyNum:buyNum entryView:weakEntryView password:@"" behaviorSrc:@"" otherInfo:nil];
return;
}
}];
weakEntryView = entry;
[self fus_requestTicketShowBuyGetDataAndFillEntry:entry roomId:currentRoomId channelId:safeChannelId roundId:safeRoundId completion:^(FUSTicketShowCollectTicketToggleResultModel * _Nullable model) {
buyGetDataModel = model;
}];
if (![NSString isNull:tipText]) {
[FUSDialogView fus_showDialog:tipText];
}
});
}
- (void)fus_requestTicketShowBuyGetDataAndFillEntry:(FUSLiveShowTimeAudienceEntryMainView *)entry - (void)fus_requestTicketShowBuyGetDataAndFillEntry:(FUSLiveShowTimeAudienceEntryMainView *)entry
roomId:(NSString *)roomId roomId:(NSString *)roomId
channelId:(NSString *)channelId channelId:(NSString *)channelId
...@@ -1152,6 +1211,23 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor ...@@ -1152,6 +1211,23 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
} failure:^(NSString *msg, NSInteger code) { } failure:^(NSString *msg, NSInteger code) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[FUSLoadingView fus_dismissProgressView]; [FUSLoadingView fus_dismissProgressView];
if (code == -20124) {
[weakEntryView fus_dismissAnimated:YES];
[FUSLiveHelper fus_quitLiveWithCompletion:nil];
return;
}
if (code == -20133) {
[weakEntryView fus_dismissAnimated:YES];
[weakSelf fus_audienceJoinRoomWithRoomId:(roomId ?: @"") password:(password ?: @"") behaviorSrc:(behaviorSrc ?: @"") otherInfo:otherInfo];
return;
}
if (code == -100) {
[FUSDialogView fus_showDialog:([NSString isNull:msg] ? [NSString fus_localString:@"宝石不足"] : msg)];
[FUSRechargeViewController fus_showRechargeViewControllerForRootVC:[UIViewController fus_topViewController] from:FUSFromLiveRoom rechargePageFrom:FUSRechargePageFromGEMsLack backHandler:^{
[[FUSLiveHelper shareInstance].currentFunctionView fus_autoShowFirstChargeViewWhenBackFromRechargeIfNeeded];
}];
return;
}
if (![NSString isNull:msg]) { if (![NSString isNull:msg]) {
[FUSDialogView fus_showDialog:msg]; [FUSDialogView fus_showDialog:msg];
} else { } else {
...@@ -1370,6 +1446,16 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor ...@@ -1370,6 +1446,16 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
}); });
} failure:^(NSString *msg, NSInteger code) { } failure:^(NSString *msg, NSInteger code) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (code == -20124) {
[weakEntryView fus_dismissAnimated:YES];
[FUSLiveHelper fus_quitLiveWithCompletion:nil];
return;
}
if (code == -20133) {
[weakEntryView fus_dismissAnimated:YES];
[weakSelf fus_audienceJoinRoomWithRoomId:(roomId ?: @"") password:@"" behaviorSrc:@"" otherInfo:nil];
return;
}
[FUSDialogView fus_showDialog:(msg ?: @"")]; [FUSDialogView fus_showDialog:(msg ?: @"")];
}); });
}]; }];
...@@ -1398,6 +1484,23 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor ...@@ -1398,6 +1484,23 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
}); });
} failure:^(NSString *msg, NSInteger code) { } failure:^(NSString *msg, NSInteger code) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (code == -20124) {
[weakEntryView fus_dismissAnimated:YES];
[FUSLiveHelper fus_quitLiveWithCompletion:nil];
return;
}
if (code == -20133) {
[weakEntryView fus_dismissAnimated:YES];
[weakSelf fus_audienceJoinRoomWithRoomId:(roomId ?: @"") password:@"" behaviorSrc:@"" otherInfo:nil];
return;
}
if (code == -100) {
[FUSDialogView fus_showDialog:([NSString isNull:msg] ? [NSString fus_localString:@"宝石不足"] : msg)];
[FUSRechargeViewController fus_showRechargeViewControllerForRootVC:[UIViewController fus_topViewController] from:FUSFromLiveRoom rechargePageFrom:FUSRechargePageFromGEMsLack backHandler:^{
[[FUSLiveHelper shareInstance].currentFunctionView fus_autoShowFirstChargeViewWhenBackFromRechargeIfNeeded];
}];
return;
}
if (![NSString isNull:msg]) { if (![NSString isNull:msg]) {
[FUSDialogView fus_showDialog:msg]; [FUSDialogView fus_showDialog:msg];
} }
...@@ -2145,7 +2248,11 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor ...@@ -2145,7 +2248,11 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
self.liveVC.backgroundImageView.hidden = NO; self.liveVC.backgroundImageView.hidden = NO;
self.liveVC.liveFunctionView.hidden = NO; self.liveVC.liveFunctionView.hidden = NO;
[self.currentFunctionView fus_showAllFunctionLayers]; [self.currentFunctionView fus_showAllFunctionLayers];
[self.liveVC fus_setupScrollEnable:YES]; if ([FUSLiveHelper shareInstance].liveType == FUSLiveTypeAudience && roomInfoModel.liveScope == 5) {
[self.liveVC fus_setupScrollEnable:NO];
} else {
[self.liveVC fus_setupScrollEnable:YES];
}
FUSLogDebug(@"FUSStreamPlayView==== 进入房间成功"); FUSLogDebug(@"FUSStreamPlayView==== 进入房间成功");
if ([FUSLiveHelper shareInstance].liveRoomType != FUSRoomTypeLinkMic) { if ([FUSLiveHelper shareInstance].liveRoomType != FUSRoomTypeLinkMic) {
...@@ -2287,6 +2394,29 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor ...@@ -2287,6 +2394,29 @@ static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_stor
// code: -20036 直播已經結束了 // code: -20036 直播已經結束了
return; return;
} }
if (code == -40013) {
dispatch_async(dispatch_get_main_queue(), ^{
NSString *channelId = [[errorDict[@"channelId"] description] ?: @"" copy];
NSString *roundId = [[errorDict[@"roundId"] description] ?: @"" copy];
[[FUSLiveHelper shareInstance] fus_handleShowTimeKickToBuyEntryWithRoomId:roomid
channelId:channelId
roundId:roundId
tipText:msg];
});
return;
}
if (code == -20065) {
dispatch_async(dispatch_get_main_queue(), ^{
[[FUSLiveHelper shareInstance] joinRoomFailuerWithErrorDict:(errorDict ?: @{})
code:-20065
msg:msg
currentRoomId:roomid
password:@""
behaviorSrc:@""
otherInfo:nil];
});
return;
}
[FUSDialogView fus_showDialog:msg]; [FUSDialogView fus_showDialog:msg];
}]; }];
} else { } else {
......
...@@ -696,7 +696,7 @@ ...@@ -696,7 +696,7 @@
if (FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePassword) { if (FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePassword) {
image = [FUSShowRoomCenterBunble imageNamed:@"live_RoomScope_password"]; image = [FUSShowRoomCenterBunble imageNamed:@"live_RoomScope_password"];
} else if (FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePay) { } else if (FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePay) {
image = [FUSShowRoomCenterBunble imageNamed:@"live_RoomScope_pay"]; image = [FUSShowRoomCenterBunble imageNamed:@"Live_botton_payIn"];
} else { } else {
image = [FUSShowRoomCenterBunble imageNamed:@"live_RoomScope_normal"]; image = [FUSShowRoomCenterBunble imageNamed:@"live_RoomScope_normal"];
} }
......
...@@ -457,6 +457,22 @@ ...@@ -457,6 +457,22 @@
NSDictionary *payload = jsonDict; NSDictionary *payload = jsonDict;
NSInteger dataType = [payload[@"dataType"] integerValue]; NSInteger dataType = [payload[@"dataType"] integerValue];
if (dataType == 1) {
FUSTicketShowCollectTicketToggleResultModel *identifierModel = [FUSTicketShowCollectTicketToggleResultModel fus_modelWithDict:payload];
NSString *incomingRoomId = (identifierModel.stageData.roomId.length > 0 ? identifierModel.stageData.roomId : identifierModel.roomId);
NSString *incomingChannelId = (identifierModel.stageData.channelId.length > 0 ? identifierModel.stageData.channelId : identifierModel.channelId);
NSString *incomingRoundId = (identifierModel.stageData.roundId.length > 0 ? identifierModel.stageData.roundId : identifierModel.roundId);
FUSRoomInfoModel *currentRoomInfoModel = FUSLiveHelper.shareInstance.roomInfoModel;
if (incomingRoomId.length > 0) {
currentRoomInfoModel.roomId = incomingRoomId;
}
if (incomingChannelId.length > 0) {
currentRoomInfoModel.channelId = incomingChannelId;
}
if (incomingRoundId.length > 0) {
currentRoomInfoModel.roundId = incomingRoundId;
}
}
if (dataType == 5) { if (dataType == 5) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
NSString *showTheme = [NSString stringWithObject:payload[@"showTheme"]]; NSString *showTheme = [NSString stringWithObject:payload[@"showTheme"]];
...@@ -469,6 +485,7 @@ ...@@ -469,6 +485,7 @@
} }
} }
FUSLiveHelper.shareInstance.roomInfoModel.introduce = showTheme; FUSLiveHelper.shareInstance.roomInfoModel.introduce = showTheme;
[self fus_saveLatestLiveTitleToLocal:showTheme];
[[FUSLiveHelper shareInstance].currentFunctionView fus_refreshLiveTopicWindow]; [[FUSLiveHelper shareInstance].currentFunctionView fus_refreshLiveTopicWindow];
[self.showTimeFrostedView fus_updateThemeText:showTheme]; [self.showTimeFrostedView fus_updateThemeText:showTheme];
}); });
...@@ -481,6 +498,7 @@ ...@@ -481,6 +498,7 @@
[self fus_restoreBottomToolButtonsAfterShowTimeIfNeeded]; [self fus_restoreBottomToolButtonsAfterShowTimeIfNeeded];
if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAnchor) { if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAnchor) {
[[FUSLiveHelper shareInstance] fus_setupScrollToSwitchRoomEnable:YES];
return; return;
} }
...@@ -559,9 +577,16 @@ ...@@ -559,9 +577,16 @@
if (stageStatus == 9999) { if (stageStatus == 9999) {
[self fus_destroyShowTimeFrostedIfNeeded]; [self fus_destroyShowTimeFrostedIfNeeded];
[self fus_restoreBottomToolButtonsAfterShowTimeIfNeeded]; [self fus_restoreBottomToolButtonsAfterShowTimeIfNeeded];
if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAudience) {
[[FUSLiveHelper shareInstance] fus_setupScrollToSwitchRoomEnable:YES];
}
return; return;
} }
self.showTimeStageStatus = stageStatus; self.showTimeStageStatus = stageStatus;
if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAudience) {
BOOL shouldDisableScrollSwitch = (stageStatus == 1 || stageStatus == 2);
[[FUSLiveHelper shareInstance] fus_setupScrollToSwitchRoomEnable:!shouldDisableScrollSwitch];
}
if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAnchor) { if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAnchor) {
bar.displayMode = FUSLiveShowTimeCollectFrostedDisplayModeAnchor; bar.displayMode = FUSLiveShowTimeCollectFrostedDisplayModeAnchor;
...@@ -1273,8 +1298,10 @@ ...@@ -1273,8 +1298,10 @@
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
__weak typeof(bottomToolView) weakBottomToolView = bottomToolView; __weak typeof(bottomToolView) weakBottomToolView = bottomToolView;
FUSRoomTicketShowConfig *ticketShowConfig = [FUSLiveHelper shareInstance].liveBeforeReadyInfo.ticketShowConfig; FUSRoomTicketShowConfig *ticketShowConfig = [FUSLiveHelper shareInstance].liveBeforeReadyInfo.ticketShowConfig;
void (^presentShowTimePopView)(FUSRoomTicketShowConfig *) = ^(FUSRoomTicketShowConfig *config) {
NSString *defaultThemeText = [FUSLiveHelper shareInstance].roomInfoModel.introduce; NSString *defaultThemeText = [FUSLiveHelper shareInstance].roomInfoModel.introduce;
FUSLiveShowTimePopView *popView = [FUSLiveShowTimePopView fus_showOnView:popContainer ticketShowConfig:ticketShowConfig themeText:defaultThemeText]; FUSLiveShowTimePopView *popView = [FUSLiveShowTimePopView fus_showOnView:popContainer ticketShowConfig:config themeText:defaultThemeText];
popView.startCollectHandler = ^(NSString * _Nonnull themeText, NSInteger ticketCount) { popView.startCollectHandler = ^(NSString * _Nonnull themeText, NSInteger ticketCount) {
__strong typeof(weakSelf) strongSelf = weakSelf; __strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) { if (!strongSelf) {
...@@ -1302,13 +1329,14 @@ ...@@ -1302,13 +1329,14 @@
return; return;
} }
NSInteger min = ticketShowConfig.collectTicketMin.integerValue; NSInteger min = config.collectTicketMin.integerValue;
NSInteger max = ticketShowConfig.collectTicketMax.integerValue; NSInteger max = config.collectTicketMax.integerValue;
if (min <= 0) { if (min <= 0) {
min = 5; [FUSDialogView fus_showDialog:[NSString fus_localString:@"当前集票配置异常"]];
return;
} }
if (max <= 0) { if (max <= 0) {
max = 50; max = min;
} }
if (max < min) { if (max < min) {
max = min; max = min;
...@@ -1338,11 +1366,9 @@ ...@@ -1338,11 +1366,9 @@
if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAnchor && weakBottomToolView) { if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAnchor && weakBottomToolView) {
[weakBottomToolView fus_removeBtnWithType:FUSLiveBottomToolTypeTool2]; [weakBottomToolView fus_removeBtnWithType:FUSLiveBottomToolTypeTool2];
innerSelf.showTimeDidRemoveTool2 = YES; innerSelf.showTimeDidRemoveTool2 = YES;
UIImage *ticketImage = [FUSShowRoomCenterBunble imageNamed:@"Live_bottom_ticket"]; UIImage *ticketImage = [FUSShowRoomCenterBunble imageNamed:@"Live_room_showTime"];
if (ticketImage) { [weakBottomToolView fus_updateBtnImageWithType:FUSLiveBottomToolTypeRoomScope image:ticketImage state:UIControlStateNormal];
[weakBottomToolView fus_updateBtnImageWithType:FUSLiveBottomToolTypeRoomScope image:ticketImage state:UIControlStateNormal]; [weakBottomToolView fus_updateBtnImageWithType:FUSLiveBottomToolTypeRoomScope image:ticketImage state:UIControlStateHighlighted];
[weakBottomToolView fus_updateBtnImageWithType:FUSLiveBottomToolTypeRoomScope image:ticketImage state:UIControlStateHighlighted];
}
} }
FUSLiveShowTimeCollectFrostedView *bar = [FUSLiveShowTimeCollectFrostedView fus_showOnView:onView]; FUSLiveShowTimeCollectFrostedView *bar = [FUSLiveShowTimeCollectFrostedView fus_showOnView:onView];
...@@ -1398,6 +1424,7 @@ ...@@ -1398,6 +1424,7 @@
NSString *updateTheme = (model.showTheme.length > 0 ? model.showTheme : finalTheme); NSString *updateTheme = (model.showTheme.length > 0 ? model.showTheme : finalTheme);
if (updateTheme.length > 0) { if (updateTheme.length > 0) {
FUSLiveHelper.shareInstance.roomInfoModel.introduce = updateTheme; FUSLiveHelper.shareInstance.roomInfoModel.introduce = updateTheme;
[innerSelf fus_saveLatestLiveTitleToLocal:updateTheme];
} }
NSInteger remainMs = (model.stageData ? model.stageData.remaintime : model.remaintime); NSInteger remainMs = (model.stageData ? model.stageData.remaintime : model.remaintime);
...@@ -1423,6 +1450,27 @@ ...@@ -1423,6 +1450,27 @@
}); });
}]; }];
}; };
};
if (ticketShowConfig.collectTicketMin.integerValue <= 0) {
[FUSLiveHttpHelper fus_requestLiveBeforeReadyWithSucceed:^(FUSLiveBeforeReadyModel *model) {
dispatch_async(dispatch_get_main_queue(), ^{
FUSRoomTicketShowConfig *latestConfig = [FUSLiveHelper shareInstance].liveBeforeReadyInfo.ticketShowConfig;
if (latestConfig.collectTicketMin.integerValue <= 0) {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"当前集票配置异常"]];
return;
}
presentShowTimePopView(latestConfig);
});
} failure:^(NSString * _Nonnull msg, int code) {
dispatch_async(dispatch_get_main_queue(), ^{
[FUSDialogView fus_showDialog:([NSString isNull:msg] ? [NSString fus_localString:@"加载失败"] : msg)];
});
}];
return;
}
presentShowTimePopView(ticketShowConfig);
} }
- (void)fus_bottomToolView:(FUSLiveBottomToolView *)bottomToolView didClickLiveRoomThemeOnView:(UIView *)containerView { - (void)fus_bottomToolView:(FUSLiveBottomToolView *)bottomToolView didClickLiveRoomThemeOnView:(UIView *)containerView {
...@@ -1447,6 +1495,7 @@ ...@@ -1447,6 +1495,7 @@
[FUSLiveHttpHelper fus_updateLiveThemeTitleWithRoomId:roomId channelId:channelId content:content succeed:^(NSDictionary *dataDict, int code) { [FUSLiveHttpHelper fus_updateLiveThemeTitleWithRoomId:roomId channelId:channelId content:content succeed:^(NSDictionary *dataDict, int code) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[FUSLoadingView fus_dismissProgressView]; [FUSLoadingView fus_dismissProgressView];
[strongSelf fus_saveLatestLiveTitleToLocal:content];
// 这里只提交更新请求;主题展示刷新由 ROOM_CID_LIVE_TOPIC_TITLE_DID_CHANGED 的 socket 推送驱动 // 这里只提交更新请求;主题展示刷新由 ROOM_CID_LIVE_TOPIC_TITLE_DID_CHANGED 的 socket 推送驱动
}); });
} failure:^(NSString *msg, NSInteger code) { } failure:^(NSString *msg, NSInteger code) {
...@@ -1458,6 +1507,19 @@ ...@@ -1458,6 +1507,19 @@
}; };
} }
- (void)fus_saveLatestLiveTitleToLocal:(NSString *)title {
NSString *uid = [NSString stringWithObject:FUSCacheDataShare.shareStore.userDetailInfo.uid];
if ([NSString isNull:uid]) {
return;
}
NSUserDefaults *userDefault = [[NSUserDefaults alloc] initWithSuiteName:uid];
if (!userDefault) {
return;
}
NSString *safeTitle = [NSString stringWithObject:title];
[userDefault setObject:([NSString isNull:safeTitle] ? @"" : safeTitle) forKey:[FUSLiveUDKeys fus_lastLiveTitleUDKey]];
}
- (void)fus_bottomToolViewDidClickGiftInteractSetting:(FUSLiveBottomToolView *)bottomToolView { - (void)fus_bottomToolViewDidClickGiftInteractSetting:(FUSLiveBottomToolView *)bottomToolView {
[self fus_chatInputViewDidClickGiftInteractSetting:nil]; [self fus_chatInputViewDidClickGiftInteractSetting:nil];
} }
...@@ -1725,14 +1787,19 @@ ...@@ -1725,14 +1787,19 @@
} }
} }
/// 进房/重连后,用房间的 collectTicket 状态决定是否需要展示“限时表演”集票入口(观众端) /// 进房/重连后同步“限时表演”磨砂条
/// 规则:
/// - 主播端:collectTicket=1 展示集票中;liveScope=5 展示表演中
/// - 观众端:collectTicket=1 或 liveScope=5 展示观众态磨砂条
/// - 其他状态:销毁磨砂条
- (void)fus_syncShowTimeFrostedWithRoomInfoModel:(FUSRoomInfoModel *)roomInfoModel { - (void)fus_syncShowTimeFrostedWithRoomInfoModel:(FUSRoomInfoModel *)roomInfoModel {
if (!roomInfoModel) { if (!roomInfoModel) {
[self fus_destroyShowTimeFrostedIfNeeded]; [self fus_destroyShowTimeFrostedIfNeeded];
return; return;
} }
if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAudience) { if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAudience
&& FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAnchor) {
[self fus_destroyShowTimeFrostedIfNeeded]; [self fus_destroyShowTimeFrostedIfNeeded];
return; return;
} }
...@@ -1748,29 +1815,88 @@ ...@@ -1748,29 +1815,88 @@
FUSLiveShowTimeCollectFrostedView *bar = [FUSLiveShowTimeCollectFrostedView fus_showOnView:onView]; FUSLiveShowTimeCollectFrostedView *bar = [FUSLiveShowTimeCollectFrostedView fus_showOnView:onView];
self.showTimeFrostedView = bar; self.showTimeFrostedView = bar;
[self fus_bindShowTimeFrostedAvatarTapHandlerIfNeeded:bar]; [self fus_bindShowTimeFrostedAvatarTapHandlerIfNeeded:bar];
bar.displayMode = FUSLiveShowTimeCollectFrostedDisplayModeAudience;
bar.cancelHandler = nil;
bar.stageStatus = 0;
bar.actionTitle = [NSString fus_localString:@"购票支持"];
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
__weak typeof(bar) weakBar = bar; if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAudience) {
bar.actionHandler = ^{ // 观众态:右侧按钮为“购票支持/抢当MVP”,不允许取消集票
__strong typeof(weakSelf) strongSelf = weakSelf; bar.displayMode = FUSLiveShowTimeCollectFrostedDisplayModeAudience;
if (!strongSelf) { bar.cancelHandler = nil;
return; bar.stageStatus = 0;
} bar.actionTitle = [NSString fus_localString:@"购票支持"];
__strong typeof(weakBar) strongBar = weakBar; __weak typeof(bar) weakBar = bar;
if (!strongBar) { bar.actionHandler = ^{
return; __strong typeof(weakSelf) strongSelf = weakSelf;
} if (!strongSelf) {
[strongSelf fus_presentShowTimeTicketActionPopupFromBar:strongBar]; return;
}; }
__strong typeof(weakBar) strongBar = weakBar;
if (!strongBar) {
return;
}
[strongSelf fus_presentShowTimeTicketActionPopupFromBar:strongBar];
};
} else {
// 主播态:根据 enterRoom 初始状态先落一个阶段,再由 progress/getinfo 纠正到实时状态
NSInteger initialStageStatus = (roomInfoModel.collectTicket == 1 ? 0 : (roomInfoModel.liveScope == 5 ? 2 : 0));
self.showTimeStageStatus = initialStageStatus;
bar.displayMode = FUSLiveShowTimeCollectFrostedDisplayModeAnchor;
bar.actionHandler = nil;
bar.actionTitle = nil;
bar.stageStatus = initialStageStatus;
// 主播态保留“取消集票”入口,走 toggleType=-1
bar.cancelHandler = ^{
__strong typeof(weakSelf) cancelSelf = weakSelf;
if (!cancelSelf) {
return;
}
NSString *cancelRoundId = cancelSelf.showTimeRoundId;
if ([NSString isNull:cancelRoundId]) {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"当前回合信息异常"]];
return;
}
FUSRoomInfoModel *currentRoomInfoModel = FUSLiveHelper.shareInstance.roomInfoModel;
NSString *cancelRoomId = [NSString stringWithObject:currentRoomInfoModel.roomId];
NSString *cancelChannelId = [NSString stringWithObject:currentRoomInfoModel.channelId];
if ([NSString isNull:cancelRoomId] || [NSString isNull:cancelChannelId]) {
[FUSDialogView fus_showDialog:[NSString fus_localString:@"当前房间信息异常"]];
return;
}
[FUSLoadingView fus_showProgressViewWithMessage:@""];
[FUSLiveHttpHelper fus_ticketShowCollectTicketToggleWithRoomId:cancelRoomId channelId:cancelChannelId toggleType:-1 roundId:cancelRoundId ticketTargetNum:0 showTheme:nil succeed:^(FUSTicketShowCollectTicketToggleResultModel * _Nonnull cancelModel) {
dispatch_async(dispatch_get_main_queue(), ^{
[FUSLoadingView fus_dismissProgressView];
[cancelSelf fus_destroyShowTimeFrostedIfNeeded];
[cancelSelf fus_resetShowTimeStateValues];
[cancelSelf fus_restoreBottomToolButtonsAfterShowTimeIfNeeded];
UIView *showOnView = [[FUSLiveHelper shareInstance].currentFunctionView fus_viewWithLayer:FUSLiveFunctionLayerManualPopView];
if (!showOnView) {
showOnView = [UIViewController fus_topViewController].view;
}
if (!showOnView) {
return;
}
FUSLiveShowTimeFrostCardPopView *pop = [FUSLiveShowTimeFrostCardPopView fus_showOnView:showOnView];
[pop fus_updateFinalTicketNum:cancelModel.finalTicketNum];
});
} failure:^(NSString * _Nonnull msg, NSInteger code) {
dispatch_async(dispatch_get_main_queue(), ^{
[FUSLoadingView fus_dismissProgressView];
[FUSDialogView fus_showDialog:([NSString isNull:msg] ? [NSString fus_localString:@"取消失败"] : msg)];
});
}];
};
}
NSString *themeText = (![NSString isNull:roomInfoModel.introduce] ? roomInfoModel.introduce : [NSString fus_localString:@"限时表演"]); NSString *themeText = (![NSString isNull:roomInfoModel.introduce] ? roomInfoModel.introduce : [NSString fus_localString:@"限时表演"]);
NSString *initialRemainingText = [NSString fus_localString:@"集票进行中"];
CGFloat initialProgress = 0;
if (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAnchor && bar.stageStatus == 2) {
initialRemainingText = [NSString fus_localString:@"已集票数 0 张!"];
initialProgress = 1;
}
[bar fus_updateWithState:FUSLiveShowTimeCollectFrostedStateStarted [bar fus_updateWithState:FUSLiveShowTimeCollectFrostedStateStarted
themeText:themeText themeText:themeText
progress:0 progress:initialProgress
remainingText:[NSString fus_localString:@"集票进行中"] remainingText:initialRemainingText
newTicketCount:0 newTicketCount:0
userModel:nil]; userModel:nil];
...@@ -1781,6 +1907,7 @@ ...@@ -1781,6 +1907,7 @@
return; return;
} }
// 二次拉取实时进度,修正 enterRoom 初始值:阶段/进度/倒计时/MVP/最新上票信息
[FUSLiveHttpHelper fus_ticketShowProgressGetInfoWithRoomId:roomId channelId:channelId roundId:roundId succeed:^(FUSTicketShowCollectTicketToggleResultModel * _Nonnull model) { [FUSLiveHttpHelper fus_ticketShowProgressGetInfoWithRoomId:roomId channelId:channelId roundId:roundId succeed:^(FUSTicketShowCollectTicketToggleResultModel * _Nonnull model) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
__strong typeof(weakSelf) strongSelf = weakSelf; __strong typeof(weakSelf) strongSelf = weakSelf;
...@@ -1788,7 +1915,9 @@ ...@@ -1788,7 +1915,9 @@
return; return;
} }
if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAudience) { BOOL isAudience = (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAudience);
BOOL isAnchor = (FUSLiveHelper.shareInstance.liveType == FUSLiveTypeAnchor);
if (!isAudience && !isAnchor) {
return; return;
} }
...@@ -1798,7 +1927,13 @@ ...@@ -1798,7 +1927,13 @@
} }
FUSLiveShowTimeCollectFrostedView *currentBar = strongSelf.showTimeFrostedView; FUSLiveShowTimeCollectFrostedView *currentBar = strongSelf.showTimeFrostedView;
if (!currentBar || currentBar.displayMode != FUSLiveShowTimeCollectFrostedDisplayModeAudience) { if (!currentBar) {
return;
}
if (isAudience && currentBar.displayMode != FUSLiveShowTimeCollectFrostedDisplayModeAudience) {
return;
}
if (isAnchor && currentBar.displayMode != FUSLiveShowTimeCollectFrostedDisplayModeAnchor) {
return; return;
} }
...@@ -1848,7 +1983,11 @@ ...@@ -1848,7 +1983,11 @@
} }
currentBar.stageStatus = stageStatus; currentBar.stageStatus = stageStatus;
currentBar.actionTitle = ([NSString stringWithObject:model.mvpInfo.mvpUserId].length > 0 ? [NSString fus_localString:@"抢当MVP"] : [NSString fus_localString:@"购票支持"]); if (isAudience) {
currentBar.actionTitle = ([NSString stringWithObject:model.mvpInfo.mvpUserId].length > 0 ? [NSString fus_localString:@"抢当MVP"] : [NSString fus_localString:@"购票支持"]);
} else {
currentBar.actionTitle = nil;
}
NSInteger remainMs = (model.stageData ? model.stageData.remaintime : model.remaintime); NSInteger remainMs = (model.stageData ? model.stageData.remaintime : model.remaintime);
NSInteger totalSeconds = -1; NSInteger totalSeconds = -1;
...@@ -1856,17 +1995,31 @@ ...@@ -1856,17 +1995,31 @@
strongSelf.showTimeCountdownRemainSeconds = remainSeconds; strongSelf.showTimeCountdownRemainSeconds = remainSeconds;
FUSLiveShowTimeCollectFrostedState showState = FUSLiveShowTimeCollectFrostedStateStarted; FUSLiveShowTimeCollectFrostedState showState = FUSLiveShowTimeCollectFrostedStateStarted;
[currentBar fus_updateAudienceWithState:showState if (isAudience) {
themeText:finalThemeText [currentBar fus_updateAudienceWithState:showState
progress:progress themeText:finalThemeText
remainingText:remainingText progress:progress
countdownTotalSeconds:totalSeconds remainingText:remainingText
countdownRemainingSeconds:remainSeconds countdownTotalSeconds:totalSeconds
newTicketCount:0 countdownRemainingSeconds:remainSeconds
giftUserModel:nil newTicketCount:0
mvpUserModel:model.mvpInfo.mvpUserInfo]; giftUserModel:nil
mvpUserModel:model.mvpInfo.mvpUserInfo];
[currentBar fus_updateTopTicketInfoWithGiftUserModel:model.buyUser newTicketCount:MAX(0, model.buyNum)];
[currentBar fus_updateTopTicketInfoWithGiftUserModel:model.buyUser newTicketCount:MAX(0, model.buyNum)];
} else {
[currentBar fus_updateWithState:showState
themeText:finalThemeText
progress:progress
remainingText:remainingText
newTicketCount:0
userModel:nil];
// 主播态也要显示顶部 lastInfo(最近上票用户 + 新票数)
[currentBar fus_updateTopTicketInfoWithGiftUserModel:model.buyUser newTicketCount:MAX(0, model.buyNum)];
if (remainSeconds > 0) {
[currentBar fus_syncCountdownTotalSeconds:totalSeconds countdownRemainingSeconds:remainSeconds];
}
}
}); });
} failure:^(NSString * _Nonnull msg, NSInteger code) { } failure:^(NSString * _Nonnull msg, NSInteger code) {
}]; }];
......
...@@ -15,6 +15,7 @@ static NSInteger const kFUSLiveShowTimeAudienceEntryMainViewTag = 90917002; ...@@ -15,6 +15,7 @@ static NSInteger const kFUSLiveShowTimeAudienceEntryMainViewTag = 90917002;
NSString * const FUSLiveShowTimeAudienceEntryTicketOptionCountTextKey = @"countText"; NSString * const FUSLiveShowTimeAudienceEntryTicketOptionCountTextKey = @"countText";
NSString * const FUSLiveShowTimeAudienceEntryTicketOptionPriceTextKey = @"priceText"; NSString * const FUSLiveShowTimeAudienceEntryTicketOptionPriceTextKey = @"priceText";
NSString * const FUSLiveShowTimeAudienceEntryTicketOptionTagTextKey = @"tagText"; NSString * const FUSLiveShowTimeAudienceEntryTicketOptionTagTextKey = @"tagText";
NSString * const FUSLiveShowTimeAudienceEntryTicketOptionImageNameTextKey = @"imageName";
@interface FUSLiveShowTimeAudienceEntryTicketOptionCardView : UIControl @interface FUSLiveShowTimeAudienceEntryTicketOptionCardView : UIControl
...@@ -151,9 +152,11 @@ NSString * const FUSLiveShowTimeAudienceEntryTicketOptionTagTextKey = @"tagText" ...@@ -151,9 +152,11 @@ NSString * const FUSLiveShowTimeAudienceEntryTicketOptionTagTextKey = @"tagText"
NSString *countText = [NSString stringWithObject:option[FUSLiveShowTimeAudienceEntryTicketOptionCountTextKey]]; NSString *countText = [NSString stringWithObject:option[FUSLiveShowTimeAudienceEntryTicketOptionCountTextKey]];
NSString *priceText = [NSString stringWithObject:option[FUSLiveShowTimeAudienceEntryTicketOptionPriceTextKey]]; NSString *priceText = [NSString stringWithObject:option[FUSLiveShowTimeAudienceEntryTicketOptionPriceTextKey]];
NSString *tagText = [NSString stringWithObject:option[FUSLiveShowTimeAudienceEntryTicketOptionTagTextKey]]; NSString *tagText = [NSString stringWithObject:option[FUSLiveShowTimeAudienceEntryTicketOptionTagTextKey]];
NSString *imageName = [NSString stringWithObject:option[FUSLiveShowTimeAudienceEntryTicketOptionImageNameTextKey]];
self.countLabel.text = ([NSString isNull:countText] ? @"x--" : countText); self.countLabel.text = ([NSString isNull:countText] ? @"x--" : countText);
self.priceLabel.text = ([NSString isNull:priceText] ? @"--" : priceText); self.priceLabel.text = ([NSString isNull:priceText] ? @"--" : priceText);
self.ticketImageView.image = [FUSShowRoomCenterBunble imageNamed:([NSString isNull:imageName] ? @"live_room_ticket" : imageName)];
if (![NSString isNull:tagText]) { if (![NSString isNull:tagText]) {
self.tagButton.hidden = NO; self.tagButton.hidden = NO;
[self.tagButton setTitle:tagText forState:UIControlStateNormal]; [self.tagButton setTitle:tagText forState:UIControlStateNormal];
...@@ -361,7 +364,7 @@ NSString * const FUSLiveShowTimeAudienceEntryTicketOptionTagTextKey = @"tagText" ...@@ -361,7 +364,7 @@ NSString * const FUSLiveShowTimeAudienceEntryTicketOptionTagTextKey = @"tagText"
- (void)fus_updateWithBuyGetDataModel:(FUSTicketShowCollectTicketToggleResultModel *)model - (void)fus_updateWithBuyGetDataModel:(FUSTicketShowCollectTicketToggleResultModel *)model
anchorFacePath:(nullable NSString *)anchorFacePath { anchorFacePath:(nullable NSString *)anchorFacePath {
NSString *theme = [model.showTheme description]; NSString *theme = [model.showTheme description];
NSInteger remainMs = (model.stageData ? model.stageData.showStatusTime : model.showStatusTime); NSInteger remainMs = (model.stageData ? model.stageData.remaintime : model.remaintime);
NSInteger remainSec = MAX(0, (NSInteger)llround(((double)remainMs / 1000.0))); NSInteger remainSec = MAX(0, (NSInteger)llround(((double)remainMs / 1000.0)));
[self fus_updateTitleText:nil [self fus_updateTitleText:nil
anchorName:(![NSString isNull:theme] ? theme : nil) anchorName:(![NSString isNull:theme] ? theme : nil)
...@@ -375,18 +378,25 @@ NSString * const FUSLiveShowTimeAudienceEntryTicketOptionTagTextKey = @"tagText" ...@@ -375,18 +378,25 @@ NSString * const FUSLiveShowTimeAudienceEntryTicketOptionTagTextKey = @"tagText"
NSInteger directNum = MAX(1, model.directBuyNum); NSInteger directNum = MAX(1, model.directBuyNum);
NSInteger strengthNum = MAX(1, model.showStrengthNum); NSInteger strengthNum = MAX(1, model.showStrengthNum);
NSInteger mvpNum = MAX(1, model.mvpBuyNum); NSInteger mvpNum = MAX(1, model.mvpBuyNum);
NSString *priceText = [@(unitPrice) description]; NSString *directPriceText = [@(MAX(0, directNum * unitPrice)) description];
NSString *strengthPriceText = [@(MAX(0, strengthNum * unitPrice)) description];
NSString *mvpPriceText = [@(MAX(0, mvpNum * unitPrice)) description];
NSDictionary *opt1 = @{ NSDictionary *opt1 = @{
FUSLiveShowTimeAudienceEntryTicketOptionCountTextKey: [NSString stringWithFormat:@"x%ld", (long)directNum], FUSLiveShowTimeAudienceEntryTicketOptionCountTextKey: [NSString stringWithFormat:@"x%ld", (long)directNum],
FUSLiveShowTimeAudienceEntryTicketOptionPriceTextKey: priceText, FUSLiveShowTimeAudienceEntryTicketOptionPriceTextKey: directPriceText,
FUSLiveShowTimeAudienceEntryTicketOptionImageNameTextKey: @"live_room_ticket",
}; };
NSDictionary *opt2 = @{ NSDictionary *opt2 = @{
FUSLiveShowTimeAudienceEntryTicketOptionCountTextKey: [NSString stringWithFormat:@"x%ld", (long)strengthNum], FUSLiveShowTimeAudienceEntryTicketOptionCountTextKey: [NSString stringWithFormat:@"x%ld", (long)strengthNum],
FUSLiveShowTimeAudienceEntryTicketOptionPriceTextKey: priceText, FUSLiveShowTimeAudienceEntryTicketOptionPriceTextKey: strengthPriceText,
FUSLiveShowTimeAudienceEntryTicketOptionTagTextKey: [NSString fus_localString:@"展示实力"],
FUSLiveShowTimeAudienceEntryTicketOptionImageNameTextKey: @"live_room_tickets",
}; };
NSDictionary *opt3 = @{ NSDictionary *opt3 = @{
FUSLiveShowTimeAudienceEntryTicketOptionCountTextKey: [NSString stringWithFormat:@"x%ld", (long)mvpNum], FUSLiveShowTimeAudienceEntryTicketOptionCountTextKey: [NSString stringWithFormat:@"x%ld", (long)mvpNum],
FUSLiveShowTimeAudienceEntryTicketOptionPriceTextKey: priceText, FUSLiveShowTimeAudienceEntryTicketOptionPriceTextKey: mvpPriceText,
FUSLiveShowTimeAudienceEntryTicketOptionTagTextKey: [NSString fus_localString:@"抢当MVP"],
FUSLiveShowTimeAudienceEntryTicketOptionImageNameTextKey: @"live_room_tickets",
}; };
[self fus_updateTicketOptions:@[opt1, opt2, opt3] selectedIndex:0]; [self fus_updateTicketOptions:@[opt1, opt2, opt3] selectedIndex:0];
} }
......
...@@ -139,6 +139,8 @@ class FUSLiveStartContentThemeEditView: UIView { ...@@ -139,6 +139,8 @@ class FUSLiveStartContentThemeEditView: UIView {
self?.selectModel?.themeId = 0 self?.selectModel?.themeId = 0
self?.selectModel?.title = "" self?.selectModel?.title = ""
self?.themeTitle = ""
self?.fus_saveThemeToLocal()
self?.reloadUI() self?.reloadUI()
}).disposed(by: disposedBag) }).disposed(by: disposedBag)
...@@ -159,6 +161,7 @@ class FUSLiveStartContentThemeEditView: UIView { ...@@ -159,6 +161,7 @@ class FUSLiveStartContentThemeEditView: UIView {
guard let model = model as? FUSLiveThemeModel else { return } guard let model = model as? FUSLiveThemeModel else { return }
self?.selectModel = model self?.selectModel = model
self?.themeTitle = themeView.themeTitle self?.themeTitle = themeView.themeTitle
self?.fus_saveThemeToLocal()
self?.reloadUI() self?.reloadUI()
} }
themeView.removeFromSuperview() themeView.removeFromSuperview()
...@@ -179,5 +182,15 @@ class FUSLiveStartContentThemeEditView: UIView { ...@@ -179,5 +182,15 @@ class FUSLiveStartContentThemeEditView: UIView {
self.closeBtn.isHidden = true self.closeBtn.isHidden = true
} }
} }
func fus_saveThemeToLocal() {
guard let uid = FUSCacheDataShare.shareStore().userDetailInfo.uid,
let userDefault = UserDefaults(suiteName: uid) else {
return
}
let selectedThemeId = self.selectModel?.themeId ?? 0
userDefault.set(selectedThemeId, forKey: FUS_SelectedLiveThemeIdUDKey)
userDefault.set((selectedThemeId > 0 ? self.themeTitle : ""), forKey: FUS_LastLiveThemeTopicUDKey)
}
} }
...@@ -428,13 +428,11 @@ import FUSCommon ...@@ -428,13 +428,11 @@ import FUSCommon
// 开播标题 // 开播标题
if !result.isEmpty, result != themeView.LiveTitleTextFiled.attributedPlaceholder?.string { if !result.isEmpty, result != themeView.LiveTitleTextFiled.attributedPlaceholder?.string {
userDefault.set(result, forKey: FUS_LastLiveThemeTopicUDKey) userDefault.set(result, forKey: FUSLiveUDKeys.fus_lastLiveTitleUDKey())
startLiveModel.title = result startLiveModel.title = result
} else { } else {
if let placeholderString = themeView.LiveTitleTextFiled.attributedPlaceholder?.string { userDefault.set("", forKey: FUSLiveUDKeys.fus_lastLiveTitleUDKey())
userDefault.set("", forKey: FUS_LastLiveThemeTopicUDKey) startLiveModel.title = themeView.LiveTitleTextFiled.attributedPlaceholder?.string ?? ""
startLiveModel.title = placeholderString
}
} }
// 开播主题名称与开播主题id // 开播主题名称与开播主题id
......
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