스피커 요청 버튼 제거

This commit is contained in:
Yu Sung 2023-08-28 23:13:43 +09:00
parent 3916a49e60
commit 88fcbc98f4
3 changed files with 20 additions and 41 deletions

View File

@ -22,8 +22,6 @@ struct LiveRoomProfilesDialogView: View {
isShowing: Binding<Bool>, isShowing: Binding<Bool>,
viewModel: LiveRoomViewModel, viewModel: LiveRoomViewModel,
roomInfo: GetRoomInfoResponse, roomInfo: GetRoomInfoResponse,
isShowRequestSpeaker: Bool,
onClickRequestSpeaker: @escaping () -> Void,
registerNotification: @escaping () -> Void, registerNotification: @escaping () -> Void,
unRegisterNotification: @escaping () -> Void, unRegisterNotification: @escaping () -> Void,
onClickProfile: @escaping (Int) -> Void onClickProfile: @escaping (Int) -> Void
@ -32,16 +30,18 @@ struct LiveRoomProfilesDialogView: View {
self.viewModel = viewModel self.viewModel = viewModel
self.roomInfo = roomInfo self.roomInfo = roomInfo
self.profiles.append( if !roomInfo.managerList.isEmpty {
AnyView( self.profiles.append(
LiveRoomProfileItemTitleView( AnyView(
title: "스탭", LiveRoomProfileItemTitleView(
count: roomInfo.managerList.count, title: "스탭",
totalCount: nil count: roomInfo.managerList.count,
totalCount: nil
)
.padding(.vertical, 14)
) )
.padding(.vertical, 14)
) )
) }
let isStaff = viewModel.isEqualToStaffId(creatorId: UserDefaults.int(forKey: .userId)) || let isStaff = viewModel.isEqualToStaffId(creatorId: UserDefaults.int(forKey: .userId)) ||
roomInfo.creatorId == UserDefaults.int(forKey: .userId) roomInfo.creatorId == UserDefaults.int(forKey: .userId)
@ -64,16 +64,18 @@ struct LiveRoomProfilesDialogView: View {
) )
} }
self.profiles.append( if (roomInfo.speakerList.count - 1) > 0 {
AnyView( self.profiles.append(
LiveRoomProfileItemTitleView( AnyView(
title: "스피커", LiveRoomProfileItemTitleView(
count: roomInfo.speakerList.count - 1, title: "스피커",
totalCount: roomInfo.totalAvailableParticipantsCount count: roomInfo.speakerList.count - 1,
totalCount: roomInfo.totalAvailableParticipantsCount
)
.padding(.vertical, 14)
) )
.padding(.vertical, 14)
) )
) }
for speaker in roomInfo.speakerList { for speaker in roomInfo.speakerList {
if speaker.id == roomInfo.creatorId { if speaker.id == roomInfo.creatorId {
@ -117,16 +119,6 @@ struct LiveRoomProfilesDialogView: View {
} }
} }
if isShowRequestSpeaker {
self.profiles.append(
AnyView(
LiveRoomProfileRequestSpeakerView {
onClickRequestSpeaker()
}
)
)
}
self.profiles.append( self.profiles.append(
AnyView( AnyView(
LiveRoomProfileItemTitleView( LiveRoomProfileItemTitleView(

View File

@ -512,10 +512,6 @@ struct LiveRoomView: View {
isShowing: $viewModel.isShowProfileList, isShowing: $viewModel.isShowProfileList,
viewModel: viewModel, viewModel: viewModel,
roomInfo: liveRoomInfo, roomInfo: liveRoomInfo,
isShowRequestSpeaker: viewModel.role != .SPEAKER,
onClickRequestSpeaker: {
viewModel.requestSpeaker()
},
registerNotification: { viewModel.creatorFollow() }, registerNotification: { viewModel.creatorFollow() },
unRegisterNotification: { viewModel.creatorUnFollow() }, unRegisterNotification: { viewModel.creatorUnFollow() },
onClickProfile: { onClickProfile: {

View File

@ -422,15 +422,6 @@ final class LiveRoomViewModel: NSObject, ObservableObject {
.store(in: &subscription) .store(in: &subscription)
} }
func requestSpeaker() {
agora.sendMessageToPeer(peerId: String(liveRoomInfo!.creatorId), rawMessage: LiveRoomRequestType.REQUEST_SPEAKER.rawValue.data(using: .utf8)!, completion: { [unowned self] errorCode in
if errorCode == .ok {
self.popupContent = "스피커 요청을 보냈습니다.\n잠시만 기다려 주세요."
self.isShowPopup = true
}
})
}
func inviteSpeaker(peerId: Int) { func inviteSpeaker(peerId: Int) {
agora.sendMessageToPeer(peerId: String(peerId), rawMessage: LiveRoomRequestType.INVITE_SPEAKER.rawValue.data(using: .utf8)!, completion: { [unowned self] errorCode in agora.sendMessageToPeer(peerId: String(peerId), rawMessage: LiveRoomRequestType.INVITE_SPEAKER.rawValue.data(using: .utf8)!, completion: { [unowned self] errorCode in
if errorCode == .ok { if errorCode == .ok {