From a7b3c9d5e7fc65ab8eefb760a655e675b198fc6d Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Tue, 15 Apr 2025 13:34:27 +0900 Subject: [PATCH] =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=20=EC=9E=85?= =?UTF-8?q?=EC=9E=A5=20=EB=A9=94=EC=8B=9C=EC=A7=80=20on/off=20=EC=8A=A4?= =?UTF-8?q?=EC=9C=84=EC=B9=98=20=EC=B6=94=EA=B0=80=20-=20=EB=9D=BC?= =?UTF-8?q?=EC=9D=B4=EB=B8=8C=20=EC=A0=95=EB=B3=B4=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?=EA=B0=80=EC=9E=A5=20=EC=95=84=EB=9E=98=EC=97=90=20=EC=9E=85?= =?UTF-8?q?=EC=9E=A5=20=EB=A9=94=EC=8B=9C=EC=A7=80=20on/off=20=EC=8A=A4?= =?UTF-8?q?=EC=9C=84=EC=B9=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Room/Dialog/LiveRoomInfoEditDialog.swift | 26 ++++++++++++++++--- .../Sources/Live/Room/LiveRoomViewModel.swift | 5 ++-- .../Sources/Live/Room/V2/LiveRoomViewV2.swift | 4 ++- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/SodaLive/Sources/Live/Room/Dialog/LiveRoomInfoEditDialog.swift b/SodaLive/Sources/Live/Room/Dialog/LiveRoomInfoEditDialog.swift index 1039e9d..3e88f01 100644 --- a/SodaLive/Sources/Live/Room/Dialog/LiveRoomInfoEditDialog.swift +++ b/SodaLive/Sources/Live/Room/Dialog/LiveRoomInfoEditDialog.swift @@ -16,6 +16,7 @@ struct LiveRoomInfoEditDialog: View { @State private var title = "" @State private var notice = "" @State private var isAdult = false + @State private var isEntryMessageEnabled = true let placeholder = "라이브 공지를 입력하세요" @@ -24,19 +25,20 @@ struct LiveRoomInfoEditDialog: View { let isLoading: Bool let coverImageUrl: String? let coverImage: UIImage? - var confirmAction: (String, String, Bool) -> Void + var confirmAction: (String, String, Bool, Bool) -> Void init( isShowing: Binding, isShowPhotoPicker: Binding, viewModel: LiveRoomViewModel, isAdult: Bool, + isEntryMessageEnabled: Bool, isLoading: Bool, currentTitle: String, currentNotice: String, coverImageUrl: String, coverImage: UIImage?, - confirmAction: @escaping (String, String, Bool) -> Void + confirmAction: @escaping (String, String, Bool, Bool) -> Void ) { self._isShowing = isShowing self._isShowPhotoPicker = isShowPhotoPicker @@ -44,6 +46,7 @@ struct LiveRoomInfoEditDialog: View { self._viewModel = StateObject(wrappedValue: viewModel) self.isLoading = isLoading self.isAdult = isAdult + self.isEntryMessageEnabled = isEntryMessageEnabled self.title = currentTitle self.notice = currentNotice @@ -159,6 +162,22 @@ struct LiveRoomInfoEditDialog: View { ) .padding(.top, 33.3) + HStack(spacing: 0) { + Text("입장메시지") + .font(.custom(Font.bold.rawValue, size: 16.7)) + .foregroundColor(Color.grayee) + + Spacer() + + Image(isEntryMessageEnabled ? "btn_toggle_on_big" : "btn_toggle_off_big") + .resizable() + .frame(width: 33.3, height: 20) + .onTapGesture { + isEntryMessageEnabled.toggle() + } + } + .padding(.top, 33.3) + HStack(spacing: 13.3) { Text("취소") .font(.custom(Font.bold.rawValue, size: 18.3)) @@ -187,7 +206,8 @@ struct LiveRoomInfoEditDialog: View { confirmAction( title, notice.trimmingCharacters(in: .whitespacesAndNewlines) != placeholder ? notice : "", - isAdult + isAdult, + isEntryMessageEnabled ) isShowing = false } diff --git a/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift b/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift index 28ffe10..d000938 100644 --- a/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift +++ b/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift @@ -129,6 +129,7 @@ final class LiveRoomViewModel: NSObject, ObservableObject { @Published var isBgOn = true @Published var isSignatureOn = true + @Published var isEntryMessageEnabled = true @Published var donationStatus: GetLiveRoomDonationStatusResponse? @Published var heartStatus: GetLiveRoomHeartListResponse? @@ -762,8 +763,6 @@ final class LiveRoomViewModel: NSObject, ObservableObject { ) if (request.title == nil && request.notice == nil && coverImage == nil && menu == liveRoomInfo?.menuPan && request.isAdult == nil) { - self.errorMessage = "변경사항이 없습니다." - self.isShowErrorPopup = true return } @@ -2273,7 +2272,7 @@ extension LiveRoomViewModel: AgoraRtmChannelDelegate { func channel(_ channel: AgoraRtmChannel, memberJoined member: AgoraRtmMember) { getRoomInfo(userId: Int(member.userId)!) { [unowned self] nickname in - if !nickname.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + if !nickname.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty && isEntryMessageEnabled { DispatchQueue.main.async { [unowned self] in self.messages.append(LiveRoomJoinChat(nickname: nickname)) self.messageChangeFlag.toggle() diff --git a/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift b/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift index fc0c1e8..7e6aeab 100644 --- a/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift +++ b/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift @@ -731,17 +731,19 @@ struct LiveRoomViewV2: View { isShowPhotoPicker: $viewModel.isShowPhotoPicker, viewModel: viewModel, isAdult: liveRoomInfo.isAdult, + isEntryMessageEnabled: viewModel.isEntryMessageEnabled, isLoading: viewModel.isLoading, currentTitle: liveRoomInfo.title, currentNotice: liveRoomInfo.notice, coverImageUrl: liveRoomInfo.coverImageUrl, coverImage: viewModel.coverImage - ) { newTitle, newNotice, isAdult in + ) { newTitle, newNotice, isAdult, isEntryMessageEnabled in self.viewModel.editLiveRoomInfo( title: newTitle, notice: newNotice, isAdult: isAdult ) + self.viewModel.isEntryMessageEnabled = isEntryMessageEnabled } } else { EmptyView()