Commit b6f574a1 by suolong

修复处理倒计时结束没调用api问题

parent 7c0eaf49
......@@ -305,6 +305,45 @@
}];
}
- (void)fus_onTicketCollectCountdownEnd {
if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAnchor) {
return;
}
NSString *roundId = self.showTimeRoundId;
if ([NSString isNull:roundId]) {
return;
}
FUSRoomInfoModel *roomInfoModel = FUSLiveHelper.shareInstance.roomInfoModel;
NSString *roomId = roomInfoModel.roomId;
NSString *channelId = roomInfoModel.channelId;
if ([NSString isNull:roomId] || [NSString isNull:channelId]) {
return;
}
__weak typeof(self) weakSelf = self;
[FUSLiveHttpHelper fus_ticketShowCollectTicketToggleWithRoomId:roomId channelId:channelId toggleType:-1 roundId:roundId ticketTargetNum:0 showTheme:nil succeed:^(FUSTicketShowCollectTicketToggleResultModel * _Nonnull cancelModel) {
dispatch_async(dispatch_get_main_queue(), ^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
[strongSelf fus_destroyShowTimeFrostedIfNeeded];
[strongSelf fus_resetShowTimeStateValues];
[strongSelf fus_restoreBottomToolButtonsAfterShowTimeIfNeeded];
UIView *onView = [[FUSLiveHelper shareInstance].currentFunctionView fus_viewWithLayer:FUSLiveFunctionLayerManualPopView];
if (!onView) onView = [UIViewController fus_topViewController].view;
if (!onView) return;
FUSLiveShowTimeFrostCardPopView *pop = [FUSLiveShowTimeFrostCardPopView fus_showOnView:onView];
[pop fus_updateFinalTicketNum:cancelModel.finalTicketNum];
});
} failure:^(NSString * _Nonnull msg, NSInteger code) {
dispatch_async(dispatch_get_main_queue(), ^{
NSString *toastMsg = ([NSString isNull:msg] ? [NSString fus_localString:@"取消失败"] : msg);
[FUSDialogView fus_showDialog:toastMsg];
});
}];
}
/// 展示“票的贡献”弹窗,并拉取贡献列表数据
- (void)fus_presentShowTimeTicketContributionPopupFromBar:(FUSLiveShowTimeCollectFrostedView *)bar {
(void)bar;
......@@ -419,6 +458,7 @@
if (dataType == 9999) {
dispatch_async(dispatch_get_main_queue(), ^{
[self fus_destroyShowTimeFrostedIfNeeded];
[self fus_resetShowTimeStateValues];
[self fus_restoreBottomToolButtonsAfterShowTimeIfNeeded];
});
return;
......@@ -466,6 +506,17 @@
bar.actionTitle = nil;
bar.stageStatus = stageStatus;
__weak typeof(self) weakSelf = self;
if (stageStatus == 0) {
bar.collectCountdownEndHandler = ^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) {
return;
}
[strongSelf fus_onTicketCollectCountdownEnd];
};
} else {
bar.collectCountdownEndHandler = nil;
}
bar.cancelHandler = ^{
__strong typeof(weakSelf) cancelSelf = weakSelf;
if (!cancelSelf) {
......@@ -492,13 +543,7 @@
dispatch_async(dispatch_get_main_queue(), ^{
[FUSLoadingView fus_dismissProgressView];
[cancelSelf fus_destroyShowTimeFrostedIfNeeded];
cancelSelf.showTimeRoundId = @"";
cancelSelf.showTimeLastFinalTicketNum = -1;
cancelSelf.showTimeStageStatus = -1;
cancelSelf.showTimeShowEndRequestedRoundId = @"";
cancelSelf.showTimeReadyShowStartRequestedRoundId = @"";
cancelSelf.isRequestingShowTimeReadyShowStart = NO;
cancelSelf.showTimeAnchorPopupRemainingSeconds = -1;
[cancelSelf fus_resetShowTimeStateValues];
[cancelSelf fus_restoreBottomToolButtonsAfterShowTimeIfNeeded];
// 取消成功后弹出磨砂卡片,展示最终集票数
......@@ -1062,6 +1107,19 @@
return nil;
}
- (void)fus_resetShowTimeStateValues {
self.showTimeRoundId = @"";
self.showTimeLastFinalTicketNum = -1;
self.showTimeCountdownRemainSeconds = -1;
self.showTimeTargetTicketNum = -1;
self.showTimeStageStatus = -1;
self.showTimeShowEndRequestedRoundId = @"";
self.showTimeMvpNeedTicketCount = -1;
self.showTimeReadyShowStartRequestedRoundId = @"";
self.isRequestingShowTimeReadyShowStart = NO;
self.showTimeAnchorPopupRemainingSeconds = -1;
}
- (void)fus_restoreBottomToolButtonsAfterShowTimeIfNeeded {
if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAnchor) {
return;
......@@ -1234,8 +1292,7 @@
dispatch_async(dispatch_get_main_queue(), ^{
[FUSLoadingView fus_dismissProgressView];
[cancelSelf fus_destroyShowTimeFrostedIfNeeded];
cancelSelf.showTimeRoundId = @"";
cancelSelf.showTimeStageStatus = -1;
[cancelSelf fus_resetShowTimeStateValues];
cancelSelf.showTimeDidRemoveTool2 = tool2ExistedBeforeStart;
[cancelSelf fus_restoreBottomToolButtonsAfterShowTimeIfNeeded];
......@@ -1891,17 +1948,8 @@
[popToDismiss fus_dismiss];
}
[strongSelf fus_destroyShowTimeFrostedIfNeeded];
strongSelf.showTimeRoundId = @"";
strongSelf.showTimeLastFinalTicketNum = -1;
strongSelf.showTimeCountdownRemainSeconds = -1;
strongSelf.showTimeTargetTicketNum = -1;
strongSelf.showTimeStageStatus = -1;
strongSelf.showTimeShowEndRequestedRoundId = @"";
[strongSelf fus_resetShowTimeStateValues];
strongSelf.showTimeDidRemoveTool2 = YES;
strongSelf.showTimeMvpNeedTicketCount = -1;
strongSelf.showTimeReadyShowStartRequestedRoundId = @"";
strongSelf.isRequestingShowTimeReadyShowStart = NO;
strongSelf.showTimeAnchorPopupRemainingSeconds = -1;
[strongSelf fus_restoreBottomToolButtonsAfterShowTimeIfNeeded];
});
} failure:^(NSString * _Nonnull msg, NSInteger code) {
......
......@@ -101,6 +101,9 @@ typedef NS_ENUM(NSInteger, FUSLiveShowTimeCollectFrostedAvatarTapType) {
/// 表演倒计时结束回调(仅 stageStatus=2 且倒计时归零时触发)
@property (nonatomic, copy, nullable) void (^performanceCountdownEndHandler)(void);
/// 集票倒计时结束回调(仅 stageStatus=0 且倒计时归零时触发)
@property (nonatomic, copy, nullable) void (^collectCountdownEndHandler)(void);
/// 移除磨砂条
- (void)fus_dismiss;
......
......@@ -102,6 +102,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60;
/// 标记倒计时归零事件是否已回调,避免重复触发
@property (nonatomic, assign) BOOL didNotifyPerformanceCountdownEnd;
@property (nonatomic, assign) BOOL didNotifyCollectCountdownEnd;
@end
......@@ -658,6 +659,7 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60;
- (void)setStageStatus:(NSInteger)stageStatus {
_stageStatus = stageStatus;
self.didNotifyPerformanceCountdownEnd = NO;
self.didNotifyCollectCountdownEnd = NO;
self.statusTagLabel.text = @"";
self.statusTagLabel.hidden = YES;
[self fus_applyBottomInfoLayout];
......@@ -720,6 +722,12 @@ static const NSInteger kFUSShowTimeCollectSeconds = 60;
self.performanceCountdownEndHandler();
}
}
if (self.stageStatus == 0 && !self.didNotifyCollectCountdownEnd) {
self.didNotifyCollectCountdownEnd = YES;
if (self.collectCountdownEndHandler) {
self.collectCountdownEndHandler();
}
}
return;
}
......
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