From 88fcbc98f40b7a6cae7eb9800839b495a57ecc5f Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Mon, 28 Aug 2023 23:13:43 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8A=A4=ED=94=BC=EC=BB=A4=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=20=EB=B2=84=ED=8A=BC=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dialog/LiveRoomProfilesDialogView.swift | 48 ++++++++----------- SodaLive/Sources/Live/Room/LiveRoomView.swift | 4 -- .../Sources/Live/Room/LiveRoomViewModel.swift | 9 ---- 3 files changed, 20 insertions(+), 41 deletions(-) diff --git a/SodaLive/Sources/Live/Room/Dialog/LiveRoomProfilesDialogView.swift b/SodaLive/Sources/Live/Room/Dialog/LiveRoomProfilesDialogView.swift index 4ae4bfb..36f852b 100644 --- a/SodaLive/Sources/Live/Room/Dialog/LiveRoomProfilesDialogView.swift +++ b/SodaLive/Sources/Live/Room/Dialog/LiveRoomProfilesDialogView.swift @@ -22,8 +22,6 @@ struct LiveRoomProfilesDialogView: View { isShowing: Binding, viewModel: LiveRoomViewModel, roomInfo: GetRoomInfoResponse, - isShowRequestSpeaker: Bool, - onClickRequestSpeaker: @escaping () -> Void, registerNotification: @escaping () -> Void, unRegisterNotification: @escaping () -> Void, onClickProfile: @escaping (Int) -> Void @@ -32,16 +30,18 @@ struct LiveRoomProfilesDialogView: View { self.viewModel = viewModel self.roomInfo = roomInfo - self.profiles.append( - AnyView( - LiveRoomProfileItemTitleView( - title: "스탭", - count: roomInfo.managerList.count, - totalCount: nil + if !roomInfo.managerList.isEmpty { + self.profiles.append( + AnyView( + LiveRoomProfileItemTitleView( + title: "스탭", + count: roomInfo.managerList.count, + totalCount: nil + ) + .padding(.vertical, 14) ) - .padding(.vertical, 14) ) - ) + } let isStaff = viewModel.isEqualToStaffId(creatorId: UserDefaults.int(forKey: .userId)) || roomInfo.creatorId == UserDefaults.int(forKey: .userId) @@ -64,16 +64,18 @@ struct LiveRoomProfilesDialogView: View { ) } - self.profiles.append( - AnyView( - LiveRoomProfileItemTitleView( - title: "스피커", - count: roomInfo.speakerList.count - 1, - totalCount: roomInfo.totalAvailableParticipantsCount + if (roomInfo.speakerList.count - 1) > 0 { + self.profiles.append( + AnyView( + LiveRoomProfileItemTitleView( + title: "스피커", + count: roomInfo.speakerList.count - 1, + totalCount: roomInfo.totalAvailableParticipantsCount + ) + .padding(.vertical, 14) ) - .padding(.vertical, 14) ) - ) + } for speaker in roomInfo.speakerList { if speaker.id == roomInfo.creatorId { @@ -117,16 +119,6 @@ struct LiveRoomProfilesDialogView: View { } } - if isShowRequestSpeaker { - self.profiles.append( - AnyView( - LiveRoomProfileRequestSpeakerView { - onClickRequestSpeaker() - } - ) - ) - } - self.profiles.append( AnyView( LiveRoomProfileItemTitleView( diff --git a/SodaLive/Sources/Live/Room/LiveRoomView.swift b/SodaLive/Sources/Live/Room/LiveRoomView.swift index 8d1a1d3..3208f5a 100644 --- a/SodaLive/Sources/Live/Room/LiveRoomView.swift +++ b/SodaLive/Sources/Live/Room/LiveRoomView.swift @@ -512,10 +512,6 @@ struct LiveRoomView: View { isShowing: $viewModel.isShowProfileList, viewModel: viewModel, roomInfo: liveRoomInfo, - isShowRequestSpeaker: viewModel.role != .SPEAKER, - onClickRequestSpeaker: { - viewModel.requestSpeaker() - }, registerNotification: { viewModel.creatorFollow() }, unRegisterNotification: { viewModel.creatorUnFollow() }, onClickProfile: { diff --git a/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift b/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift index 2aa96dc..526a075 100644 --- a/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift +++ b/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift @@ -422,15 +422,6 @@ final class LiveRoomViewModel: NSObject, ObservableObject { .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) { agora.sendMessageToPeer(peerId: String(peerId), rawMessage: LiveRoomRequestType.INVITE_SPEAKER.rawValue.data(using: .utf8)!, completion: { [unowned self] errorCode in if errorCode == .ok {