Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
pidan
/
FuSiLive
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4a360abd
authored
Mar 23, 2026
by
suolong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理代表演接口
parent
4bbb013d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
338 additions
and
16 deletions
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Other/FUSLiveHttpHelper.h
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Other/FUSLiveHttpHelper.m
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/View/FunctionView/ChatInputView/FUSLiveChatInputHelper.m
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/View/FunctionView/ChatInputView/FUSLiveShowTimeCancelConfirmPopView.h
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/View/FunctionView/ChatInputView/FUSLiveShowTimeCancelConfirmPopView.m
Modules/FUSShowRoomModule/FUSShowRoomModule/Others/FUSShowRoomURLs.h
Modules/FUSShowRoomModule/FUSShowRoomModule/Others/FUSShowRoomURLs.m
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Other/FUSLiveHttpHelper.h
View file @
4a360abd
...
@@ -948,6 +948,12 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -948,6 +948,12 @@ NS_ASSUME_NONNULL_BEGIN
succeed
:(
void
(
^
)(
FUSTicketShowCollectTicketToggleResultModel
*
model
))
succeed
succeed
:(
void
(
^
)(
FUSTicketShowCollectTicketToggleResultModel
*
model
))
succeed
failure
:(
void
(
^
)(
NSString
*
msg
,
NSInteger
code
))
failure
;
failure
:(
void
(
^
)(
NSString
*
msg
,
NSInteger
code
))
failure
;
+
(
void
)
fus_ticketShowReadyShowStartWithRoomId
:(
NSString
*
)
roomId
channelId
:(
NSString
*
)
channelId
roundId
:(
NSString
*
)
roundId
succeed
:(
void
(
^
)(
FUSTicketShowCollectTicketToggleResultModel
*
model
))
succeed
failure
:(
void
(
^
)(
NSString
*
msg
,
NSInteger
code
))
failure
;
/// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新)
/// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新)
/// @param roomId 房间ID
/// @param roomId 房间ID
/// @param channelId 频道ID
/// @param channelId 频道ID
...
...
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/Other/FUSLiveHttpHelper.m
View file @
4a360abd
...
@@ -3092,6 +3092,35 @@
...
@@ -3092,6 +3092,35 @@
}];
}];
}
}
+
(
void
)
fus_ticketShowReadyShowStartWithRoomId
:
(
NSString
*
)
roomId
channelId
:
(
NSString
*
)
channelId
roundId
:
(
NSString
*
)
roundId
succeed
:
(
void
(
^
)(
FUSTicketShowCollectTicketToggleResultModel
*
model
))
succeed
failure
:
(
void
(
^
)(
NSString
*
msg
,
NSInteger
code
))
failure
{
NSString
*
uid
=
FUSCacheDataShare
.
shareStore
.
userDetailInfo
.
uid
;
if
([
NSString
isNull
:
uid
]
||
[
NSString
isNull
:
roomId
]
||
[
NSString
isNull
:
channelId
]
||
[
NSString
isNull
:
roundId
])
{
if
(
failure
)
failure
([
NSString
fus_localString
:
@"参数错误"
],
-
3
);
return
;
}
NSDictionary
*
params
=
@{
@"uid"
:
uid
,
@"roomId"
:
roomId
,
@"channelId"
:
channelId
,
@"roundId"
:
roundId
};
[
FUSHttpHelper
postRequestBinaryWithUrl
:
FUSShowRoomURLs
.
fus_URL_TicketShow_ReadyShow_Start
params
:
params
success
:^
(
NSDictionary
*
_Nullable
dataDict
,
int
code
)
{
FUSTicketShowCollectTicketToggleResultModel
*
model
=
[
FUSTicketShowCollectTicketToggleResultModel
fus_modelWithDict
:
dataDict
];
if
(
succeed
)
succeed
(
model
);
}
failure
:^
(
NSDictionary
*
_Nullable
dataDict
,
int
code
)
{
if
(
failure
)
failure
(
dataDict
[
@"msg"
],
code
);
}];
}
+
(
void
)
fus_ticketShowProgressGetInfoWithRoomId
:
(
NSString
*
)
roomId
+
(
void
)
fus_ticketShowProgressGetInfoWithRoomId
:
(
NSString
*
)
roomId
channelId
:
(
NSString
*
)
channelId
channelId
:
(
NSString
*
)
channelId
roundId
:
(
NSString
*
)
roundId
roundId
:
(
NSString
*
)
roundId
...
...
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/View/FunctionView/ChatInputView/FUSLiveChatInputHelper.m
View file @
4a360abd
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#import "FUSLiveShowTimeCollectFrostedView.h"
#import "FUSLiveShowTimeCollectFrostedView.h"
#import "FUSLiveRoomThemePopView.h"
#import "FUSLiveRoomThemePopView.h"
#import "FUSLiveShowTimeTicketActionPopView.h"
#import "FUSLiveShowTimeTicketActionPopView.h"
#import "FUSLiveShowTimeCancelConfirmPopView.h"
#import "FUSLiveFunctionLayerView.h"
#import "FUSLiveFunctionLayerView.h"
#import <FUSFoundation/FUSFoundation-Swift.h>
#import <FUSFoundation/FUSFoundation-Swift.h>
...
@@ -71,6 +72,14 @@
...
@@ -71,6 +72,14 @@
/// 抢当 MVP 需要购买的票数(兜底按 mvpUserNum + 1 计算)
/// 抢当 MVP 需要购买的票数(兜底按 mvpUserNum + 1 计算)
@property
(
nonatomic
,
assign
)
NSInteger
showTimeMvpNeedTicketCount
;
@property
(
nonatomic
,
assign
)
NSInteger
showTimeMvpNeedTicketCount
;
/// 记录已触发“进入待表演”接口的回合,避免同一回合在多次推送下重复请求
@property
(
nonatomic
,
copy
)
NSString
*
showTimeReadyShowStartRequestedRoundId
;
/// 标记接口请求进行中,避免短时间内多次进来并发触发
@property
(
nonatomic
,
assign
)
BOOL
isRequestingShowTimeReadyShowStart
;
/// 主播端“票已集齐/取消确认”弹窗倒计时剩余秒数(两层弹窗之间需要延续同一倒计时)
@property
(
nonatomic
,
assign
)
NSInteger
showTimeAnchorPopupRemainingSeconds
;
@end
@end
@implementation
FUSLiveChatInputHelper
@implementation
FUSLiveChatInputHelper
...
@@ -89,6 +98,9 @@
...
@@ -89,6 +98,9 @@
_showTimeTargetTicketNum
=
-
1
;
_showTimeTargetTicketNum
=
-
1
;
_showTimeStageStatus
=
-
1
;
_showTimeStageStatus
=
-
1
;
_showTimeMvpNeedTicketCount
=
-
1
;
_showTimeMvpNeedTicketCount
=
-
1
;
_showTimeReadyShowStartRequestedRoundId
=
@""
;
_isRequestingShowTimeReadyShowStart
=
NO
;
_showTimeAnchorPopupRemainingSeconds
=
-
1
;
[
self
registerReceiptNotification
];
[
self
registerReceiptNotification
];
...
@@ -321,12 +333,16 @@
...
@@ -321,12 +333,16 @@
}
}
[
FUSLoadingView
fus_showProgressViewWithMessage
:
@""
];
[
FUSLoadingView
fus_showProgressViewWithMessage
:
@""
];
// 取消集票成功后会清掉当前回合与进度缓存,同时重置“待表演触发”状态,避免后续新回合被误判为已触发
[
FUSLiveHttpHelper
fus_ticketShowCollectTicketToggleWithRoomId
:
cancelRoomId
channelId
:
cancelChannelId
toggleType
:-
1
roundId
:
cancelRoundId
ticketTargetNum
:
0
showTheme
:
nil
succeed
:^
(
FUSTicketShowCollectTicketToggleResultModel
*
_Nonnull
cancelModel
)
{
[
FUSLiveHttpHelper
fus_ticketShowCollectTicketToggleWithRoomId
:
cancelRoomId
channelId
:
cancelChannelId
toggleType
:-
1
roundId
:
cancelRoundId
ticketTargetNum
:
0
showTheme
:
nil
succeed
:^
(
FUSTicketShowCollectTicketToggleResultModel
*
_Nonnull
cancelModel
)
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[
FUSLoadingView
fus_dismissProgressView
];
[
FUSLoadingView
fus_dismissProgressView
];
[
cancelSelf
fus_destroyShowTimeFrostedIfNeeded
];
[
cancelSelf
fus_destroyShowTimeFrostedIfNeeded
];
cancelSelf
.
showTimeRoundId
=
@""
;
cancelSelf
.
showTimeRoundId
=
@""
;
cancelSelf
.
showTimeLastFinalTicketNum
=
-
1
;
cancelSelf
.
showTimeLastFinalTicketNum
=
-
1
;
cancelSelf
.
showTimeReadyShowStartRequestedRoundId
=
@""
;
cancelSelf
.
isRequestingShowTimeReadyShowStart
=
NO
;
cancelSelf
.
showTimeAnchorPopupRemainingSeconds
=
-
1
;
});
});
}
failure
:^
(
NSString
*
_Nonnull
msg
,
NSInteger
code
)
{
}
failure
:^
(
NSString
*
_Nonnull
msg
,
NSInteger
code
)
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
...
@@ -356,6 +372,187 @@
...
@@ -356,6 +372,187 @@
NSInteger
target
=
MAX
(
0
,
model
.
targetTicketNum
);
NSInteger
target
=
MAX
(
0
,
model
.
targetTicketNum
);
NSInteger
finalNum
=
MAX
(
0
,
model
.
finalTicketNum
);
NSInteger
finalNum
=
MAX
(
0
,
model
.
finalTicketNum
);
self
.
showTimeTargetTicketNum
=
target
;
self
.
showTimeTargetTicketNum
=
target
;
if
(
FUSLiveHelper
.
shareInstance
.
liveType
==
FUSLiveTypeAnchor
)
{
NSString
*
readyRoundId
=
(
self
.
showTimeRoundId
.
length
>
0
?
self
.
showTimeRoundId
:
@""
);
// 推送达到目标票数后,主播端需要自动进入“待表演”阶段;同一回合可能会多次推送,因此必须做回合级别去重
if
(
stageStatus
==
0
&&
target
>
0
&&
finalNum
>=
target
&&
readyRoundId
.
length
>
0
)
{
BOOL
didRequestInThisRound
=
(
!
[
NSString
isNull
:
self
.
showTimeReadyShowStartRequestedRoundId
]
&&
[
self
.
showTimeReadyShowStartRequestedRoundId
isEqualToString
:
readyRoundId
]);
if
(
!
didRequestInThisRound
&&
!
self
.
isRequestingShowTimeReadyShowStart
)
{
// 这里先落标记再发请求,确保即使连续收到多条“已达标”推送,也只会触发一次
self
.
showTimeReadyShowStartRequestedRoundId
=
readyRoundId
;
self
.
isRequestingShowTimeReadyShowStart
=
YES
;
FUSRoomInfoModel
*
roomInfoModel
=
FUSLiveHelper
.
shareInstance
.
roomInfoModel
;
NSString
*
readyRoomId
=
(
model
.
stageData
.
roomId
.
length
>
0
?
model
.
stageData
.
roomId
:
(
model
.
roomId
.
length
>
0
?
model
.
roomId
:
roomInfoModel
.
roomId
));
NSString
*
readyChannelId
=
(
model
.
stageData
.
channelId
.
length
>
0
?
model
.
stageData
.
channelId
:
(
model
.
channelId
.
length
>
0
?
model
.
channelId
:
roomInfoModel
.
channelId
));
if
(
!
[
NSString
isNull
:
readyRoomId
]
&&
!
[
NSString
isNull
:
readyChannelId
])
{
__weak
typeof
(
self
)
weakSelf
=
self
;
[
FUSLiveHttpHelper
fus_ticketShowReadyShowStartWithRoomId
:
readyRoomId
channelId
:
readyChannelId
roundId
:
readyRoundId
succeed
:^
(
FUSTicketShowCollectTicketToggleResultModel
*
_Nonnull
respModel
)
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
__strong
typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
if
(
!
strongSelf
)
{
return
;
}
strongSelf
.
isRequestingShowTimeReadyShowStart
=
NO
;
UIView
*
onView
=
[[
FUSLiveHelper
shareInstance
].
currentFunctionView
fus_viewWithLayer
:
FUSLiveFunctionLayerManualPopView
];
if
(
!
onView
)
{
onView
=
[
UIViewController
fus_topViewController
].
view
;
}
if
(
onView
)
{
__weak
typeof
(
strongSelf
)
innerWeakSelf
=
strongSelf
;
void
(
^
cancelCollectTicket
)(
FUSLiveShowTimeCancelConfirmPopView
*
_Nullable
)
=
^
(
FUSLiveShowTimeCancelConfirmPopView
*
_Nullable
popToDismiss
)
{
__strong
typeof
(
innerWeakSelf
)
innerStrongSelf
=
innerWeakSelf
;
if
(
!
innerStrongSelf
)
{
return
;
}
NSString
*
cancelRoundId
=
innerStrongSelf
.
showTimeRoundId
;
FUSRoomInfoModel
*
roomInfoModel
=
FUSLiveHelper
.
shareInstance
.
roomInfoModel
;
NSString
*
cancelRoomId
=
(
respModel
.
stageData
.
roomId
.
length
>
0
?
respModel
.
stageData
.
roomId
:
(
respModel
.
roomId
.
length
>
0
?
respModel
.
roomId
:
roomInfoModel
.
roomId
));
NSString
*
cancelChannelId
=
(
respModel
.
stageData
.
channelId
.
length
>
0
?
respModel
.
stageData
.
channelId
:
(
respModel
.
channelId
.
length
>
0
?
respModel
.
channelId
:
roomInfoModel
.
channelId
));
if
([
NSString
isNull
:
cancelRoundId
]
||
[
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
];
if
(
popToDismiss
)
{
[
popToDismiss
fus_dismiss
];
}
[
innerStrongSelf
fus_destroyShowTimeFrostedIfNeeded
];
innerStrongSelf
.
showTimeRoundId
=
@""
;
innerStrongSelf
.
showTimeLastFinalTicketNum
=
-
1
;
innerStrongSelf
.
showTimeReadyShowStartRequestedRoundId
=
@""
;
innerStrongSelf
.
isRequestingShowTimeReadyShowStart
=
NO
;
innerStrongSelf
.
showTimeAnchorPopupRemainingSeconds
=
-
1
;
});
}
failure
:^
(
NSString
*
_Nonnull
msg
,
NSInteger
code
)
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[
FUSLoadingView
fus_dismissProgressView
];
NSString
*
toastMsg
=
([
NSString
isNull
:
msg
]
?
[
NSString
fus_localString
:
@"取消失败"
]
:
msg
);
[
FUSDialogView
fus_showDialog
:
toastMsg
];
});
}];
};
__block
void
(
^
showReadyToPerformPopView
)(
NSInteger
);
__block
void
(
^
showCancelConfirmPopView
)(
NSInteger
);
showCancelConfirmPopView
=
^
(
NSInteger
seconds
)
{
__strong
typeof
(
innerWeakSelf
)
innerStrongSelf
=
innerWeakSelf
;
if
(
!
innerStrongSelf
)
{
return
;
}
NSInteger
showSeconds
=
MAX
(
0
,
seconds
);
FUSLiveShowTimeCancelConfirmPopView
*
cancelConfirmPopView
=
[
FUSLiveShowTimeCancelConfirmPopView
fus_showOnView
:
onView
countdownSeconds
:
showSeconds
];
__weak
typeof
(
cancelConfirmPopView
)
weakCancelConfirmPopView
=
cancelConfirmPopView
;
cancelConfirmPopView
.
continueHandler
=
^
{
__strong
typeof
(
innerWeakSelf
)
innerStrongSelf2
=
innerWeakSelf
;
__strong
typeof
(
weakCancelConfirmPopView
)
strongCancelConfirmPopView
=
weakCancelConfirmPopView
;
if
(
!
innerStrongSelf2
)
{
return
;
}
NSInteger
remainSeconds
=
(
strongCancelConfirmPopView
?
[
strongCancelConfirmPopView
fus_currentRemainingSeconds
]
:
0
);
innerStrongSelf2
.
showTimeAnchorPopupRemainingSeconds
=
remainSeconds
;
if
(
strongCancelConfirmPopView
)
{
[
strongCancelConfirmPopView
fus_dismiss
];
}
if
(
showReadyToPerformPopView
)
{
showReadyToPerformPopView
(
remainSeconds
);
}
};
cancelConfirmPopView
.
confirmHandler
=
^
{
__strong
typeof
(
weakCancelConfirmPopView
)
strongCancelConfirmPopView
=
weakCancelConfirmPopView
;
cancelCollectTicket
(
strongCancelConfirmPopView
);
};
};
showReadyToPerformPopView
=
^
(
NSInteger
seconds
)
{
__strong
typeof
(
innerWeakSelf
)
innerStrongSelf
=
innerWeakSelf
;
if
(
!
innerStrongSelf
)
{
return
;
}
NSInteger
showSeconds
=
MAX
(
0
,
seconds
);
FUSLiveShowTimeCancelConfirmPopView
*
readyPopView
=
[
FUSLiveShowTimeCancelConfirmPopView
fus_showReadyToPerformOnView
:
onView
countdownSeconds
:
showSeconds
];
__weak
typeof
(
readyPopView
)
weakReadyPopView
=
readyPopView
;
readyPopView
.
continueHandler
=
^
{
__strong
typeof
(
innerWeakSelf
)
innerStrongSelf2
=
innerWeakSelf
;
__strong
typeof
(
weakReadyPopView
)
strongReadyPopView
=
weakReadyPopView
;
if
(
!
innerStrongSelf2
)
{
return
;
}
NSInteger
remainSeconds
=
(
strongReadyPopView
?
[
strongReadyPopView
fus_currentRemainingSeconds
]
:
0
);
innerStrongSelf2
.
showTimeAnchorPopupRemainingSeconds
=
remainSeconds
;
if
(
strongReadyPopView
)
{
[
strongReadyPopView
fus_dismiss
];
}
if
(
showCancelConfirmPopView
)
{
showCancelConfirmPopView
(
remainSeconds
);
}
};
readyPopView
.
confirmHandler
=
^
{
__strong
typeof
(
innerWeakSelf
)
innerStrongSelf3
=
innerWeakSelf
;
__strong
typeof
(
weakReadyPopView
)
strongReadyPopView
=
weakReadyPopView
;
if
(
strongReadyPopView
)
{
[
strongReadyPopView
fus_dismiss
];
}
if
(
innerStrongSelf3
)
{
innerStrongSelf3
.
showTimeAnchorPopupRemainingSeconds
=
-
1
;
}
[
FUSDialogView
fus_showDialog
:[
NSString
fus_localString
:
@"开始表演功能待接入"
]];
};
readyPopView
.
autoCancelHandler
=
^
{
__strong
typeof
(
innerWeakSelf
)
innerStrongSelf4
=
innerWeakSelf
;
__strong
typeof
(
weakReadyPopView
)
strongReadyPopView
=
weakReadyPopView
;
if
(
strongReadyPopView
)
{
[
strongReadyPopView
fus_dismiss
];
}
if
(
innerStrongSelf4
)
{
innerStrongSelf4
.
showTimeAnchorPopupRemainingSeconds
=
-
1
;
}
cancelCollectTicket
(
nil
);
};
};
NSInteger
initialSeconds
=
(
strongSelf
.
showTimeAnchorPopupRemainingSeconds
>
0
?
strongSelf
.
showTimeAnchorPopupRemainingSeconds
:
30
);
strongSelf
.
showTimeAnchorPopupRemainingSeconds
=
initialSeconds
;
if
(
showReadyToPerformPopView
)
{
showReadyToPerformPopView
(
initialSeconds
);
}
}
});
}
failure
:^
(
NSString
*
_Nonnull
msg
,
NSInteger
code
)
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
__strong
typeof
(
weakSelf
)
strongSelf
=
weakSelf
;
if
(
!
strongSelf
)
{
return
;
}
// 失败也不回滚 showTimeReadyShowStartRequestedRoundId:严格保证“每次集票开启只请求一次”,避免在异常抖动下重复打后端
strongSelf
.
isRequestingShowTimeReadyShowStart
=
NO
;
NSString
*
toastMsg
=
([
NSString
isNull
:
msg
]
?
[
NSString
fus_localString
:
@"进入待表演失败"
]
:
msg
);
[
FUSDialogView
fus_showDialog
:
toastMsg
];
});
}];
}
else
{
self
.
isRequestingShowTimeReadyShowStart
=
NO
;
}
}
}
}
NSInteger
remaining
=
MAX
(
0
,
target
-
finalNum
);
NSInteger
remaining
=
MAX
(
0
,
target
-
finalNum
);
CGFloat
progress
=
(
target
>
0
?
((
CGFloat
)
finalNum
/
(
CGFloat
)
target
)
:
0
);
CGFloat
progress
=
(
target
>
0
?
((
CGFloat
)
finalNum
/
(
CGFloat
)
target
)
:
0
);
NSString
*
remainingText
=
[
NSString
stringWithFormat
:[
NSString
fus_localString
:
@"还差 %zd 张!"
],
(
NSInteger
)
remaining
];
NSString
*
remainingText
=
[
NSString
stringWithFormat
:[
NSString
fus_localString
:
@"还差 %zd 张!"
],
(
NSInteger
)
remaining
];
...
...
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/View/FunctionView/ChatInputView/FUSLiveShowTimeCancelConfirmPopView.h
View file @
4a360abd
...
@@ -3,23 +3,32 @@
...
@@ -3,23 +3,32 @@
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
/**
/**
限时表演(主播端)
取消表演二次确认弹窗视图
限时表演(主播端)
通用双按钮弹窗视图(对齐限时表演相关设计)
设计目标:
设计目标:
- 独立于 Helper 的 UI 视图类,仅负责界面与交互展示
- 独立于 Helper 的 UI 视图类,仅负责界面与交互展示
- 提供 30s(或外部传入)自动取消倒计时
,倒计时结束自动触发“确定”
- 提供 30s(或外部传入)自动取消倒计时
- 外部通过 block 获取
“继续表演”和“确定”两种操作
结果
- 外部通过 block 获取
左右按钮点击与自动取消触发
结果
- 使用 Masonry 进行约束布局,样式复用项目统一的配色和字体工具
- 使用 Masonry 进行约束布局,样式复用项目统一的配色和字体工具
*/
*/
@interface
FUSLiveShowTimeCancelConfirmPopView
:
UIView
@interface
FUSLiveShowTimeCancelConfirmPopView
:
UIView
/**
用户点击“继续表演”后的回调(不取消当前回合
) */
/**
左侧按钮点击回调(默认用于“继续表演/取消集票”等
) */
@property
(
nonatomic
,
copy
,
nullable
)
void
(
^
continueHandler
)(
void
);
@property
(
nonatomic
,
copy
,
nullable
)
void
(
^
continueHandler
)(
void
);
/**
用户点击“确定”或倒计时归零后的回调(取消当前回合
) */
/**
右侧按钮点击回调(默认用于“确定/开始表演”等
) */
@property
(
nonatomic
,
copy
,
nullable
)
void
(
^
confirmHandler
)(
void
);
@property
(
nonatomic
,
copy
,
nullable
)
void
(
^
confirmHandler
)(
void
);
/**
/**
倒计时结束自动取消回调(仅“票已集齐,请开始表演!”弹窗会触发)
说明:
- 该弹窗倒计时文案为“30S 后自动取消”,业务上需要到点自动执行取消
- 点击左侧按钮仍会走二次确认弹窗(由外部决定是否再弹确认)
*/
@property
(
nonatomic
,
copy
,
nullable
)
void
(
^
autoCancelHandler
)(
void
);
/**
在指定父视图上展示弹窗并启动倒计时
在指定父视图上展示弹窗并启动倒计时
@param onView 承载弹窗的父视图(通常为手动弹层容器或顶层 VC.view)
@param onView 承载弹窗的父视图(通常为手动弹层容器或顶层 VC.view)
...
@@ -29,6 +38,15 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -29,6 +38,15 @@ NS_ASSUME_NONNULL_BEGIN
+
(
instancetype
)
fus_showOnView
:(
UIView
*
)
onView
countdownSeconds
:(
NSInteger
)
seconds
;
+
(
instancetype
)
fus_showOnView
:(
UIView
*
)
onView
countdownSeconds
:(
NSInteger
)
seconds
;
/**
/**
在指定父视图上展示“票已集齐,请开始表演!”弹窗并启动倒计时
@param onView 承载弹窗的父视图(通常为手动弹层容器或顶层 VC.view)
@param seconds 初始倒计时秒数(<=0 则不展示倒计时文案与自动取消逻辑)
@return 已添加到父视图上的弹窗实例
*/
+
(
instancetype
)
fus_showReadyToPerformOnView
:(
UIView
*
)
onView
countdownSeconds
:(
NSInteger
)
seconds
;
/**
主动关闭弹窗
主动关闭弹窗
说明:会停止内部倒计时并移除自身
说明:会停止内部倒计时并移除自身
...
...
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/View/FunctionView/ChatInputView/FUSLiveShowTimeCancelConfirmPopView.m
View file @
4a360abd
...
@@ -24,6 +24,9 @@
...
@@ -24,6 +24,9 @@
@property
(
nonatomic
,
assign
)
BOOL
hasConfirmed
;
@property
(
nonatomic
,
assign
)
BOOL
hasConfirmed
;
/// 弹窗样式类型:0-取消表演二次确认 1-票已集齐开始表演
@property
(
nonatomic
,
assign
)
NSInteger
popStyleType
;
@end
@end
@implementation
FUSLiveShowTimeCancelConfirmPopView
@implementation
FUSLiveShowTimeCancelConfirmPopView
...
@@ -34,6 +37,35 @@
...
@@ -34,6 +37,35 @@
}
}
FUSLiveShowTimeCancelConfirmPopView
*
view
=
[[
FUSLiveShowTimeCancelConfirmPopView
alloc
]
initWithFrame
:
CGRectZero
];
FUSLiveShowTimeCancelConfirmPopView
*
view
=
[[
FUSLiveShowTimeCancelConfirmPopView
alloc
]
initWithFrame
:
CGRectZero
];
view
.
popStyleType
=
0
;
[
view
fus_applyStyleIfNeeded
];
[
onView
addSubview
:
view
];
[
view
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
edges
.
equalTo
(
onView
);
}];
view
.
alpha
=
0
;
[
UIView
animateWithDuration
:
0
.
2
animations
:
^
{
view
.
alpha
=
1
;
}];
if
(
seconds
>
0
)
{
[
view
fus_startCountdownWithSeconds
:
seconds
];
}
else
{
view
.
countdownLabel
.
text
=
@""
;
}
return
view
;
}
+
(
instancetype
)
fus_showReadyToPerformOnView
:(
UIView
*
)
onView
countdownSeconds
:(
NSInteger
)
seconds
{
if
(
!
onView
)
{
return
[[
self
alloc
]
initWithFrame
:
CGRectZero
];
}
FUSLiveShowTimeCancelConfirmPopView
*
view
=
[[
FUSLiveShowTimeCancelConfirmPopView
alloc
]
initWithFrame
:
CGRectZero
];
view
.
popStyleType
=
1
;
[
view
fus_applyStyleIfNeeded
];
[
onView
addSubview
:
view
];
[
onView
addSubview
:
view
];
[
view
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
view
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
edges
.
equalTo
(
onView
);
make
.
edges
.
equalTo
(
onView
);
...
@@ -61,9 +93,11 @@
...
@@ -61,9 +93,11 @@
self
.
backgroundColor
=
UIColor
.
clearColor
;
self
.
backgroundColor
=
UIColor
.
clearColor
;
_remainingSeconds
=
0
;
_remainingSeconds
=
0
;
_hasConfirmed
=
NO
;
_hasConfirmed
=
NO
;
_popStyleType
=
0
;
[
self
fus_setupViews
];
[
self
fus_setupViews
];
[
self
fus_setupConstraints
];
[
self
fus_setupConstraints
];
[
self
fus_applyStyleIfNeeded
];
return
self
;
return
self
;
}
}
...
@@ -84,7 +118,6 @@
...
@@ -84,7 +118,6 @@
[
self
addSubview
:
self
.
contentView
];
[
self
addSubview
:
self
.
contentView
];
self
.
titleLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectZero
];
self
.
titleLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectZero
];
self
.
titleLabel
.
text
=
[
NSString
fus_localString
:
@"确定取消表演?"
];
self
.
titleLabel
.
textColor
=
[
UIColor
colorWithHex
:
@"#111111"
];
self
.
titleLabel
.
textColor
=
[
UIColor
colorWithHex
:
@"#111111"
];
self
.
titleLabel
.
font
=
[
UIFont
fus_themeBoldFont
:
16
];
self
.
titleLabel
.
font
=
[
UIFont
fus_themeBoldFont
:
16
];
self
.
titleLabel
.
textAlignment
=
NSTextAlignmentCenter
;
self
.
titleLabel
.
textAlignment
=
NSTextAlignmentCenter
;
...
@@ -99,12 +132,9 @@
...
@@ -99,12 +132,9 @@
CGFloat
buttonH
=
40
;
CGFloat
buttonH
=
40
;
self
.
continueButton
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
self
.
continueButton
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
self
.
continueButton
.
backgroundColor
=
UIColor
.
whiteColor
;
self
.
continueButton
.
backgroundColor
=
[
UIColor
colorWithHex
:
@"#E6E8EB"
]
;
self
.
continueButton
.
layer
.
cornerRadius
=
buttonH
/
2
.
0
;
self
.
continueButton
.
layer
.
cornerRadius
=
buttonH
/
2
.
0
;
self
.
continueButton
.
layer
.
masksToBounds
=
YES
;
self
.
continueButton
.
layer
.
masksToBounds
=
YES
;
self
.
continueButton
.
layer
.
borderWidth
=
1
;
self
.
continueButton
.
layer
.
borderColor
=
[
UIColor
colorWithHex
:
@"#E6E8EB"
].
CGColor
;
[
self
.
continueButton
setTitle
:[
NSString
fus_localString
:
@"继续表演"
]
forState
:
UIControlStateNormal
];
[
self
.
continueButton
setTitleColor
:[
UIColor
colorWithHex
:
@"#1F1F1F"
]
forState
:
UIControlStateNormal
];
[
self
.
continueButton
setTitleColor
:[
UIColor
colorWithHex
:
@"#1F1F1F"
]
forState
:
UIControlStateNormal
];
self
.
continueButton
.
titleLabel
.
font
=
[
UIFont
fus_themeBoldFont
:
15
];
self
.
continueButton
.
titleLabel
.
font
=
[
UIFont
fus_themeBoldFont
:
15
];
[
self
.
continueButton
addTarget
:
self
action
:
@selector
(
fus_onTapContinue
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
self
.
continueButton
addTarget
:
self
action
:
@selector
(
fus_onTapContinue
)
forControlEvents
:
UIControlEventTouchUpInside
];
...
@@ -114,13 +144,25 @@
...
@@ -114,13 +144,25 @@
self
.
confirmButton
.
backgroundColor
=
[
UIColor
colorWithHex
:
@"#52DDE2"
];
self
.
confirmButton
.
backgroundColor
=
[
UIColor
colorWithHex
:
@"#52DDE2"
];
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
setTitle
:[
NSString
fus_localString
:
@"确定"
]
forState
:
UIControlStateNormal
];
[
self
.
confirmButton
setTitleColor
:
UIColor
.
blackColor
forState
:
UIControlStateNormal
];
[
self
.
confirmButton
setTitleColor
:
UIColor
.
blackColor
forState
:
UIControlStateNormal
];
self
.
confirmButton
.
titleLabel
.
font
=
[
UIFont
fus_themeBoldFont
:
15
];
self
.
confirmButton
.
titleLabel
.
font
=
[
UIFont
fus_themeBoldFont
:
15
];
[
self
.
confirmButton
addTarget
:
self
action
:
@selector
(
fus_onTapConfirm
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
self
.
confirmButton
addTarget
:
self
action
:
@selector
(
fus_onTapConfirm
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
self
.
contentView
addSubview
:
self
.
confirmButton
];
[
self
.
contentView
addSubview
:
self
.
confirmButton
];
}
}
-
(
void
)
fus_applyStyleIfNeeded
{
if
(
self
.
popStyleType
==
1
)
{
self
.
titleLabel
.
text
=
[
NSString
fus_localString
:
@"票已集齐,请开始表演!"
];
[
self
.
continueButton
setTitle
:[
NSString
fus_localString
:
@"取消集票"
]
forState
:
UIControlStateNormal
];
[
self
.
confirmButton
setTitle
:[
NSString
fus_localString
:
@"开始表演"
]
forState
:
UIControlStateNormal
];
return
;
}
self
.
titleLabel
.
text
=
[
NSString
fus_localString
:
@"确定取消表演?"
];
[
self
.
continueButton
setTitle
:[
NSString
fus_localString
:
@"继续表演"
]
forState
:
UIControlStateNormal
];
[
self
.
confirmButton
setTitle
:[
NSString
fus_localString
:
@"确定"
]
forState
:
UIControlStateNormal
];
}
-
(
void
)
fus_setupConstraints
{
-
(
void
)
fus_setupConstraints
{
[
self
.
bgButton
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
bgButton
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
edges
.
equalTo
(
self
);
make
.
edges
.
equalTo
(
self
);
...
@@ -140,17 +182,17 @@
...
@@ -140,17 +182,17 @@
}];
}];
[
self
.
countdownLabel
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
countdownLabel
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
titleLabel
.
mas_bottom
).
offset
(
10
);
make
.
top
.
equalTo
(
self
.
titleLabel
.
mas_bottom
).
offset
(
8
);
make
.
left
.
equalTo
(
self
.
contentView
).
offset
(
20
);
make
.
left
.
equalTo
(
self
.
contentView
).
offset
(
20
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
20
);
make
.
right
.
equalTo
(
self
.
contentView
).
offset
(
-
20
);
}];
}];
CGFloat
buttonH
=
40
;
CGFloat
buttonH
=
40
;
[
self
.
continueButton
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
continueButton
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
countdownLabel
.
mas_bottom
).
offset
(
20
);
make
.
top
.
equalTo
(
self
.
countdownLabel
.
mas_bottom
).
offset
(
18
);
make
.
left
.
equalTo
(
self
.
contentView
).
offset
(
20
);
make
.
left
.
equalTo
(
self
.
contentView
).
offset
(
20
);
make
.
height
.
equalTo
(
@
(
buttonH
));
make
.
height
.
equalTo
(
@
(
buttonH
));
make
.
bottom
.
equalTo
(
self
.
contentView
).
offset
(
-
20
);
make
.
bottom
.
equalTo
(
self
.
contentView
).
offset
(
-
18
);
}];
}];
[
self
.
confirmButton
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
[
self
.
confirmButton
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
...
@@ -181,7 +223,7 @@
...
@@ -181,7 +223,7 @@
dispatch_source_cancel
(
strongSelf
.
countdownTimer
);
dispatch_source_cancel
(
strongSelf
.
countdownTimer
);
strongSelf
.
countdownTimer
=
nil
;
strongSelf
.
countdownTimer
=
nil
;
dispatch_async
(
dispatch_get_main_queue
(),
^
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[
strongSelf
fus_trigger
Confirm
IfNeeded
];
[
strongSelf
fus_trigger
AutoCancel
IfNeeded
];
});
});
return
;
return
;
}
}
...
@@ -195,6 +237,27 @@
...
@@ -195,6 +237,27 @@
dispatch_resume
(
self
.
countdownTimer
);
dispatch_resume
(
self
.
countdownTimer
);
}
}
-
(
void
)
fus_triggerAutoCancelIfNeeded
{
if
(
self
.
hasConfirmed
)
{
return
;
}
self
.
hasConfirmed
=
YES
;
[
self
fus_stopCountdownTimer
];
self
.
continueButton
.
enabled
=
NO
;
self
.
confirmButton
.
enabled
=
NO
;
if
(
self
.
popStyleType
==
1
)
{
if
(
self
.
autoCancelHandler
)
{
self
.
autoCancelHandler
();
}
return
;
}
if
(
self
.
confirmHandler
)
{
self
.
confirmHandler
();
}
}
-
(
void
)
fus_stopCountdownTimer
{
-
(
void
)
fus_stopCountdownTimer
{
if
(
self
.
countdownTimer
)
{
if
(
self
.
countdownTimer
)
{
dispatch_source_cancel
(
self
.
countdownTimer
);
dispatch_source_cancel
(
self
.
countdownTimer
);
...
@@ -204,7 +267,7 @@
...
@@ -204,7 +267,7 @@
-
(
void
)
fus_refreshCountdownText
{
-
(
void
)
fus_refreshCountdownText
{
NSInteger
seconds
=
MAX
(
0
,
self
.
remainingSeconds
);
NSInteger
seconds
=
MAX
(
0
,
self
.
remainingSeconds
);
self
.
countdownLabel
.
text
=
[
NSString
stringWithFormat
:
@"%zdS%@"
,
(
NSInteger
)
seconds
,
[
NSString
fus_localString
:
@"后自动取消"
]];
self
.
countdownLabel
.
text
=
[
NSString
stringWithFormat
:
@"%zdS
%@"
,
(
NSInteger
)
seconds
,
[
NSString
fus_localString
:
@"后自动取消"
]];
}
}
-
(
void
)
fus_onTapContinue
{
-
(
void
)
fus_onTapContinue
{
...
...
Modules/FUSShowRoomModule/FUSShowRoomModule/Others/FUSShowRoomURLs.h
View file @
4a360abd
...
@@ -590,6 +590,9 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -590,6 +590,9 @@ NS_ASSUME_NONNULL_BEGIN
/// Ticket Show - 功能 - 主播端切换限时表演的集票(开始/取消)
/// Ticket Show - 功能 - 主播端切换限时表演的集票(开始/取消)
+
(
NSString
*
)
fus_URL_TicketShow_CollectTicket_Toggle
;
+
(
NSString
*
)
fus_URL_TicketShow_CollectTicket_Toggle
;
/// Ticket Show - 功能 - 主播端进入待表演
+
(
NSString
*
)
fus_URL_TicketShow_ReadyShow_Start
;
/// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新)
/// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新)
+
(
NSString
*
)
fus_URL_TicketShow_Progress_GetInfo
;
+
(
NSString
*
)
fus_URL_TicketShow_Progress_GetInfo
;
...
...
Modules/FUSShowRoomModule/FUSShowRoomModule/Others/FUSShowRoomURLs.m
View file @
4a360abd
...
@@ -970,6 +970,12 @@
...
@@ -970,6 +970,12 @@
return
[
FUSConfig
.
sharedInstanced
.
pathConfigs
apiUrl
:
@"/ticketshow/collectTicket/toggle"
];
return
[
FUSConfig
.
sharedInstanced
.
pathConfigs
apiUrl
:
@"/ticketshow/collectTicket/toggle"
];
}
}
/// Ticket Show - 功能 - 主播端进入待表演
+
(
NSString
*
)
fus_URL_TicketShow_ReadyShow_Start
{
return
[
FUSConfig
.
sharedInstanced
.
pathConfigs
apiUrl
:
@"/ticketshow/readyShow/start"
];
}
/// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新)
/// Ticket Show - 视图 - 获取表演票的集票信息(观众端进房刷新)
+
(
NSString
*
)
fus_URL_TicketShow_Progress_GetInfo
+
(
NSString
*
)
fus_URL_TicketShow_Progress_GetInfo
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment