Skip to content

Commit 2da855d

Browse files
lleihai123MinTate
authored andcommitted
【TUILiveKit】【Android】【iOS】optimize code
1 parent a118eaa commit 2da855d

30 files changed

+117
-77
lines changed

Android/tuilivekit/src/main/java/com/trtc/uikit/livekit/TUILivePreviewFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
5555
liveRoomTransaction.commit();
5656

5757
LiveDefine.RoomParams params = new LiveDefine.RoomParams();
58-
params.maxSeatCount = 8;
58+
//The default value is the maximum number of seat supported by the package
59+
params.maxSeatCount = 0;
5960
params.seatMode = TUIRoomDefine.SeatMode.APPLY_TO_TAKE;
6061
params.roomName = TUILogin.getNickName();
6162
mTUIVoiceRoomFragment = new TUIVoiceRoomFragment(mVoiceRoomId, LiveDefine.RoomBehavior.PREPARE_CREATE, params);

README-zh_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ _简体中文 | [English](README.md)_
77
## 产品特性
88

99
<p align="center">
10-
<img src="Preview/tuilivekit-zh.png"/>
10+
<img src="https://github.com/Tencent-RTC/TUILiveKit/blob/main/Preview/tuilivekit-zh.png"/>
1111
</p>
1212

1313
- **完善的 UI 交互**:我们提供含 UI 的开源组件 TUILiveKit,可以节省您 90% 开发时间,您只需要花费30分钟就可以拥有一款类似抖音的在线直播应用。

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ _[简体中文](README-zh_CN.md) | English_
88
## Product Features
99

1010
<p align="center">
11-
<img src="Preview/tuilivekit-zh.png"/>
11+
<img src="https://github.com/Tencent-RTC/TUILiveKit/blob/main/Preview/tuilivekit.png"/>
1212
</p>
1313

1414
- **Comprehensive UI Interaction**:We provide an open-source component TUILiveKit with UI, which can save you 90% of development time. You only need to spend 30 minutes to have an online live streaming app similar to TikTok.
@@ -40,4 +40,4 @@ Here, we take the UI-included integration TUILiveKit as an example, which is als
4040
- Welcome to submit [**issue**](https://github.com/tencentyun/TUILiveRoom/issues),
4141
- Welcome to join our Telegram Group to communicate with our professional engineers! We are more than happy to hear from you,Click to join: https://t.me/+EPk6TMZEZMM5OGY1
4242
Or scan the QR code
43-
<img src="Preview/telegram-code.jpg"/>
43+
<img src="https://github.com/Tencent-RTC/TUILiveKit/blob/main/Preview/telegram-code.jpg"/>

iOS/TUILiveKit/Source/Common/Basic/Fluxor/Store.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ open class Store<State, Environment>: ObservableObject {
5656
reducers.forEach(register(reducer:))
5757
}
5858

59+
deinit {
60+
debugPrint("deinit \(type(of: self))")
61+
}
62+
5963
// MARK: - Dispatching
6064

6165
/**

iOS/TUILiveKit/Source/Common/UIComponent/AudioEffect/AudioEffectView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class AudioEffectView: UIView {
1414
var backButtonClickClosure: ((UIButton)->Void)?
1515

1616
private var isViewReady: Bool = false
17-
private var cancellables = Set<AnyCancellable>()
1817

1918
private let backButton: UIButton = {
2019
let view = UIButton(type: .system)

iOS/TUILiveKit/Source/LiveRoom/Core/LiveKitStore.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import Combine
1313
class LiveKitStore {
1414
@Published var selfInfo: UserInfo = UserInfo()
1515
@Published var applyLinkAudienceList: [UserInfo] = []
16-
let maxSeatCount: Int = 9
1716
let musicList: Observable<[MusicInfo]> = Observable(MusicInfo.defaultMusicInfoList())
1817
let currentMusicInfo: Observable<MusicInfo> = Observable(MusicInfo())
1918
let isPortrait: Observable<Bool> = Observable(true)

iOS/TUILiveKit/Source/LiveRoom/Core/RoomEngineService.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ extension RoomEngineService {
8282

8383
func enterRoom(roomId: String, onSuccess: @escaping TUISuccessBlock, onError: @escaping TUIErrorBlock) {
8484
LiveKitLog.info("\(#file)", "\(#line)", "enterRoom:[roomId:\(roomId)]")
85-
roomEngine.enterRoom(roomId, roomType: .live) { [weak self] _ in
85+
roomEngine.enterRoom(roomId, roomType: .live) { [weak self] roomInfo in
8686
LiveKitLog.info("\(#file)", "\(#line)", "enterRoom:onSuccess [roomId:\(roomId)]")
8787
self?.enterRoomSuccess()
88+
self?.liveRoomInfo.maxSeatCount = roomInfo?.maxSeatCount ?? 1
8889
onSuccess()
8990
} onError: { code, message in
9091
LiveKitLog.error("\(#file)", "\(#line)", "enterRoom:[roomId:\(roomId),code:\(code) message:\(message)]")

iOS/TUILiveKit/Source/LiveRoom/Data/LiveRoomInfo.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class LiveRoomInfo {
2020
let linkingAudienceList: Observable<[UserInfo]> = Observable([])
2121
let roomConfig: RoomConfig = RoomConfig()
2222
let userLiveStatus: Observable<UserLiveStatus> = Observable(.none)
23+
var maxSeatCount:Int = 0
2324
var giftIncome:Int = 0
2425
var giftPeopleMap:[String:String] = [:]
2526
var createTime:TimeInterval = 0

iOS/TUILiveKit/Source/LiveRoom/View/Anchor/AnchorView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ extension AnchorView {
166166
roomInfo.roomType = .conference
167167
roomInfo.roomId = liveRoomInfo.roomId.value
168168
roomInfo.name = liveRoomInfo.name.value
169-
roomInfo.maxSeatCount = engineService.liveKitStore.maxSeatCount
170169
roomInfo.seatMode = .applyToTake
171170
roomInfo.roomType = .live
172171
roomInfo.isSeatEnabled = true

iOS/TUILiveKit/Source/LiveRoom/View/Anchor/LivingView/Panel/AnchorLinkControlPanel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ extension AnchorLinkControlPanel: UITableViewDelegate {
230230
let label = UILabel(frame: CGRect(x: 24, y: 0, width: headerView.frame.width , height: headerView.frame.height))
231231
if section == 0 {
232232
label.text = .localizedReplace(.anchorLinkControlSeatCount,
233-
replace: "\(linkingAudienceList.count)/\(engineService.liveKitStore.maxSeatCount - 1)")
233+
replace: "\(linkingAudienceList.count)/\(max(liveRoomInfo.maxSeatCount,1) - 1)")
234234
} else if section == 1 {
235235
label.text = .localizedReplace(.anchorLinkControlRequestCount,
236236
replace: "\(applyLinkAudienceList.count)")

0 commit comments

Comments
 (0)