From dfe17c7797a580df4f7a569a19bde20bd76bdd0e Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Tue, 18 Mar 2025 22:52:39 +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=EC=88=98=EC=A0=95=20=EC=98=A4=EB=A5=98=20-=20?= =?UTF-8?q?=EB=8C=93=EA=B8=80=20=EC=88=98=EC=A0=95=20=EB=AA=A8=EB=93=9C=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=EC=97=90=EC=84=9C=20=EB=8B=A4=EB=A5=B8=20?= =?UTF-8?q?=EB=8C=93=EA=B8=80=20=EC=93=B0=EA=B8=B0=20=ED=98=B9=EC=9D=80=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20=EB=93=B1=EC=9D=98=20=EC=95=A1=EC=85=98?= =?UTF-8?q?=EC=9D=84=20=ED=95=B4=EC=84=9C=20=EB=8C=93=EA=B8=80=20=EC=88=98?= =?UTF-8?q?=EC=9D=98=20=EB=B3=80=ED=99=94=EA=B0=80=20=EC=9E=88=EC=9D=84=20?= =?UTF-8?q?=EB=95=8C=20=EB=82=B4=20=EA=B8=80=EC=9D=B4=20=EC=95=84=EB=8B=8C?= =?UTF-8?q?=20=EB=8B=A4=EB=A5=B8=20=EC=82=AC=EB=9E=8C=EC=9D=98=20=EA=B8=80?= =?UTF-8?q?=EC=9D=B4=20=EC=88=98=EC=A0=95=20=EB=AA=A8=EB=93=9C=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=B4=EC=9D=B4=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Comment/AudioContentCommentItemView.swift | 3 +- .../Comment/AudioContentCommentListView.swift | 20 ++++---- .../AudioContentCommentListViewModel.swift | 4 ++ .../Comment/AudioContentListReplyView.swift | 48 ++++++++++--------- .../AudioContentListReplyViewModel.swift | 4 ++ 5 files changed, 45 insertions(+), 34 deletions(-) diff --git a/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentItemView.swift b/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentItemView.swift index 2f06823..0efb224 100644 --- a/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentItemView.swift +++ b/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentItemView.swift @@ -120,11 +120,11 @@ struct AudioContentCommentItemView: View { .frame(width: 35, height: 35) .padding(6.7) .onTapGesture { + isModeModify = false hideKeyboard() if commentItem.comment != comment { modifyComment(commentItem.id, comment) } - isModeModify = false } } .background(Color.gray23) @@ -188,6 +188,7 @@ struct AudioContentCommentItemView: View { .font(.custom(Font.medium.rawValue, size: 14)) .foregroundColor(Color.gray77) .onTapGesture { + isModeModify = false onClickDelete(commentItem.id) isShowPopupMenu = false } diff --git a/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListView.swift b/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListView.swift index 0ba52ec..bb1a53c 100644 --- a/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListView.swift +++ b/SodaLive/Sources/Content/Detail/Comment/AudioContentCommentListView.swift @@ -78,11 +78,11 @@ struct AudioContentCommentListView: View { HStack(spacing: 8) { KFImage(URL(string: UserDefaults.string(forKey: .profileImage))) - .cancelOnDisappear(true) - .downsampling(size: CGSize(width: 33.3, height: 33.3)) - .resizable() - .frame(width: 33.3, height: 33.3) - .clipShape(Circle()) + .cancelOnDisappear(true) + .downsampling(size: CGSize(width: 33.3, height: 33.3)) + .resizable() + .frame(width: 33.3, height: 33.3) + .clipShape(Circle()) HStack(spacing: 0) { TextField("댓글을 입력해 보세요.", text: $viewModel.comment) @@ -122,11 +122,11 @@ struct AudioContentCommentListView: View { .padding(.bottom, 13.3) .padding(.horizontal, 13.3) - ScrollView(.vertical, showsIndicators: false) { - LazyVStack(spacing: 13.3) { - ForEach(0..() + @Published var isRegisterComment = false @Published var isLoading = false @Published var errorMessage = "" @Published var isShowPopup = false @@ -85,6 +86,7 @@ class AudioContentCommentListViewModel: ObservableObject { } isLoading = true + isRegisterComment = true repository.registerComment(audioContentId: audioContentId, comment: comment, isSecret: isSecret) .sink { result in @@ -96,6 +98,7 @@ class AudioContentCommentListViewModel: ObservableObject { } } receiveValue: { [unowned self] response in self.isLoading = false + self.isRegisterComment = false let responseData = response.data do { @@ -103,6 +106,7 @@ class AudioContentCommentListViewModel: ObservableObject { let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData) if decoded.success { + self.commentList.removeAll() self.comment = "" self.page = 1 self.isLast = false diff --git a/SodaLive/Sources/Content/Detail/Comment/AudioContentListReplyView.swift b/SodaLive/Sources/Content/Detail/Comment/AudioContentListReplyView.swift index d6abf5e..8ba8105 100644 --- a/SodaLive/Sources/Content/Detail/Comment/AudioContentListReplyView.swift +++ b/SodaLive/Sources/Content/Detail/Comment/AudioContentListReplyView.swift @@ -110,35 +110,37 @@ struct AudioContentListReplyView: View { .padding(.horizontal, 26.7) .padding(.bottom, 13.3) - ScrollView(.vertical, showsIndicators: false) { - LazyVStack(spacing: 13.3) { - ForEach(0..() + @Published var isRegisterComment = false @Published var isLoading = false @Published var errorMessage = "" @Published var isShowPopup = false @@ -83,6 +84,7 @@ final class AudioContentListReplyViewModel: ObservableObject { } isLoading = true + isRegisterComment = true repository.registerComment(audioContentId: audioContentId, comment: comment, parentId: commentId) .sink { result in @@ -94,6 +96,7 @@ final class AudioContentListReplyViewModel: ObservableObject { } } receiveValue: { [unowned self] response in self.isLoading = false + self.isRegisterComment = false let responseData = response.data do { @@ -101,6 +104,7 @@ final class AudioContentListReplyViewModel: ObservableObject { let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData) if decoded.success { + self.commentList.removeAll() self.comment = "" self.page = 1 self.isLast = false