From 47cd685f8040474ebaee2ebd7847e973ea6a1a38 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Wed, 21 Aug 2024 21:40:14 +0900 Subject: [PATCH] =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=20-=20=ED=9B=84?= =?UTF-8?q?=EC=9B=90=20=EB=A9=94=EC=8B=9C=EC=A7=80,=20=EB=A3=B0=EB=A0=9B?= =?UTF-8?q?=20=EA=B2=B0=EA=B3=BC=20=EB=AA=A8=EB=93=A0=20=EC=9C=A0=EC=A0=80?= =?UTF-8?q?=EC=97=90=EA=B2=8C=20=EB=B3=B4=EC=9D=B4=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LiveRoomDonationMessageDialog.swift | 9 +++++--- .../LiveRoomDonationMessageItemView.swift | 13 +++++++---- .../Sources/Live/Room/V2/LiveRoomViewV2.swift | 23 ++++++++----------- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationMessageDialog.swift b/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationMessageDialog.swift index eb87971..1016fa6 100644 --- a/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationMessageDialog.swift +++ b/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationMessageDialog.swift @@ -9,8 +9,10 @@ import SwiftUI struct LiveRoomDonationMessageDialog: View { + @StateObject var viewModel: LiveRoomViewModel @Binding var isShowing: Bool - @StateObject var viewModel = LiveRoomViewModel() + + @State var creatorId = 0 var body: some View { ZStack { @@ -45,7 +47,7 @@ struct LiveRoomDonationMessageDialog: View { ForEach(0.. Void var body: some View { @@ -32,10 +33,12 @@ struct LiveRoomDonationMessageItemView: View { Spacer() - Image("ic_close_white") - .resizable() - .frame(width: 13.3, height: 13.3) - .onTapGesture { deleteDonationMessage(message.uuid) } + if creatorId == UserDefaults.int(forKey: .userId) { + Image("ic_close_white") + .resizable() + .frame(width: 13.3, height: 13.3) + .onTapGesture { deleteDonationMessage(message.uuid) } + } } .padding(13.3) .background(message.canMessage.trimmingCharacters(in: .whitespaces).isEmpty ? Color(hex: "c25264").opacity(0.8) : Color.gray33) @@ -51,6 +54,7 @@ struct LiveRoomDonationMessageItemView: View { canMessage: "10캔을 후원하셨습니다", donationMessage: "ㅅㅅㅅ" ), + creatorId: 0, deleteDonationMessage: { _ in } ) } @@ -63,6 +67,7 @@ struct LiveRoomDonationMessageItemView: View { canMessage: "", donationMessage: "[테스트] 당첨!" ), + creatorId: 0, deleteDonationMessage: { _ in } ) } diff --git a/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift b/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift index ec73774..7aa9ac2 100644 --- a/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift +++ b/SodaLive/Sources/Live/Room/V2/LiveRoomViewV2.swift @@ -203,18 +203,15 @@ struct LiveRoomViewV2: View { ) } - if liveRoomInfo.creatorId == UserDefaults.int(forKey: .userId) && - UserDefaults.string(forKey: .role) == MemberRole.CREATOR.rawValue { - LiveRoomRightBottomButton( - imageName: "ic_donation_message_list", - onClick: { viewModel.isShowDonationMessagePopup = true } - ) - } else { - LiveRoomRightBottomButton( - imageName: "ic_donation", - onClick: { viewModel.isShowDonationPopup = true } - ) - } + LiveRoomRightBottomButton( + imageName: "ic_donation", + onClick: { viewModel.isShowDonationPopup = true } + ) + + LiveRoomRightBottomButton( + imageName: "ic_donation_message_list", + onClick: { viewModel.isShowDonationMessagePopup = true } + ) } .padding(.trailing, 13.3) @@ -668,7 +665,7 @@ struct LiveRoomViewV2: View { LiveRoomDonationRankingDialog(isShowing: $viewModel.isShowDonationRankingPopup) } .sheet(isPresented: $viewModel.isShowDonationMessagePopup) { - LiveRoomDonationMessageDialog(isShowing: $viewModel.isShowDonationMessagePopup) + LiveRoomDonationMessageDialog(viewModel: viewModel, isShowing: $viewModel.isShowDonationMessagePopup) } }