From d1a90ad599e1d1ef827a795d5e56760911e62182 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Fri, 30 Aug 2024 17:24:26 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=EB=8C=93?= =?UTF-8?q?=EA=B8=80=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20-=20=EC=9C=A0?= =?UTF-8?q?=EB=A3=8C=20=EC=BD=98=ED=85=90=EC=B8=A0=EB=A5=BC=20=EA=B5=AC?= =?UTF-8?q?=EB=A7=A4=ED=95=9C=20=EC=82=AC=EB=9E=8C=EC=9D=B4=20=EB=B9=84?= =?UTF-8?q?=EB=B0=80=EB=8C=93=EA=B8=80=EC=9D=84=20=EB=93=B1=EB=A1=9D?= =?UTF-8?q?=ED=95=A0=20=EC=88=98=20=EC=9E=88=EB=8A=94=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Comment/AudioContentCommentListView.swift | 23 +++++++++++++++++++ .../AudioContentCommentListViewModel.swift | 4 +++- .../Content/Detail/ContentDetailView.swift | 3 ++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListView.swift b/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListView.swift index 25a79c7..09798d3 100644 --- a/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListView.swift +++ b/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListView.swift @@ -14,6 +14,7 @@ struct AudioContentCommentListView: View { let creatorId: Int let audioContentId: Int + let isShowSecret: Bool @StateObject var viewModel = AudioContentCommentListViewModel() @@ -50,6 +51,28 @@ struct AudioContentCommentListView: View { .padding(.bottom, 13.3) .padding(.horizontal, 13.3) + if isShowSecret { + HStack(spacing: 8) { + Spacer() + + Image(viewModel.isSecret ? "btn_select_checked" : "btn_select_normal") + .resizable() + .frame(width: 20, height: 20) + .onTapGesture { + viewModel.isSecret.toggle() + } + + Text("비밀댓글") + .font(.custom(Font.medium.rawValue, size: 12)) + .foregroundColor(Color.grayee) + .onTapGesture { + viewModel.isSecret.toggle() + } + } + .padding(.bottom, 13.3) + .padding(.horizontal, 13.3) + } + HStack(spacing: 8) { KFImage(URL(string: UserDefaults.string(forKey: .profileImage))) .cancelOnDisappear(true) diff --git a/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListViewModel.swift b/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListViewModel.swift index 848e49c..fd1cf56 100644 --- a/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListViewModel.swift +++ b/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListViewModel.swift @@ -22,6 +22,8 @@ class AudioContentCommentListViewModel: ObservableObject { @Published var totalCommentCount = 0 @Published var commentList = [GetAudioContentCommentListItem]() + @Published var isSecret = false + var audioContentId = 0 var page = 1 var isLast = false @@ -84,7 +86,7 @@ class AudioContentCommentListViewModel: ObservableObject { isLoading = true - repository.registerComment(audioContentId: audioContentId, comment: comment) + repository.registerComment(audioContentId: audioContentId, comment: comment, isSecret: isSecret) .sink { result in switch result { case .finished: diff --git a/SodaLive/Sources/Content/Detail/ContentDetailView.swift b/SodaLive/Sources/Content/Detail/ContentDetailView.swift index ef21a64..a6787de 100644 --- a/SodaLive/Sources/Content/Detail/ContentDetailView.swift +++ b/SodaLive/Sources/Content/Detail/ContentDetailView.swift @@ -361,7 +361,8 @@ struct ContentDetailView: View { AudioContentCommentListView( isPresented: $isShowCommentListView, creatorId: viewModel.audioContent!.creator.creatorId, - audioContentId: viewModel.audioContent!.contentId + audioContentId: viewModel.audioContent!.contentId, + isShowSecret: viewModel.audioContent!.existOrdered ) } )