콘텐츠 답글 - 댓글이 랜덤으로 보이는 버그 수정

This commit is contained in:
Yu Sung 2023-09-13 16:54:24 +09:00
parent 3bcd2b7dba
commit 48b1093dac
3 changed files with 15 additions and 26 deletions

View File

@ -9,10 +9,8 @@ import SwiftUI
import Kingfisher import Kingfisher
struct AudioContentCommentItemView: View { struct AudioContentCommentItemView: View {
@Binding var isDisabledNavigationLink: Bool
let contentCreatorId: Int let contentCreatorId: Int
let audioContentId: Int
let commentItem: GetAudioContentCommentListItem let commentItem: GetAudioContentCommentListItem
let isReplyComment: Bool let isReplyComment: Bool
let isShowPopupMenuButton: Bool let isShowPopupMenuButton: Bool
@ -120,12 +118,20 @@ struct AudioContentCommentItemView: View {
.padding(.top, commentItem.donationCan > 0 ? 0 : 13.3) .padding(.top, commentItem.donationCan > 0 ? 0 : 13.3)
if !isReplyComment { if !isReplyComment {
NavigationLink(
destination: AudioContentListReplyView(
creatorId: contentCreatorId,
audioContentId: audioContentId,
parentComment: commentItem
)
) {
Text(commentItem.replyCount > 0 ? "답글 \(commentItem.replyCount)" : "답글 쓰기") Text(commentItem.replyCount > 0 ? "답글 \(commentItem.replyCount)" : "답글 쓰기")
.font(.custom(Font.medium.rawValue, size: 13.3)) .font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "9970ff")) .foregroundColor(Color(hex: "9970ff"))
} }
} }
} }
}
Spacer() Spacer()
} }
@ -145,7 +151,6 @@ struct AudioContentCommentItemView: View {
.foregroundColor(Color(hex: "777777")) .foregroundColor(Color(hex: "777777"))
.onTapGesture { .onTapGesture {
isModeModify = true isModeModify = true
isDisabledNavigationLink = true
isShowPopupMenu = false isShowPopupMenu = false
} }
} }

View File

@ -19,8 +19,6 @@ struct AudioContentCommentListView: View {
@State private var commentId: Int = 0 @State private var commentId: Int = 0
@State private var isShowDeletePopup: Bool = false @State private var isShowDeletePopup: Bool = false
@State private var isDisabledNavigationLink: Bool = false
@State private var isShowReplyView: Bool = false
var body: some View { var body: some View {
NavigationView { NavigationView {
@ -105,18 +103,9 @@ struct AudioContentCommentListView: View {
ForEach(0..<viewModel.commentList.count, id: \.self) { index in ForEach(0..<viewModel.commentList.count, id: \.self) { index in
let comment = viewModel.commentList[index] let comment = viewModel.commentList[index]
VStack { VStack {
NavigationLink(
destination: AudioContentListReplyView(
creatorId: creatorId,
audioContentId: audioContentId,
parentComment: comment
),
isActive: $isShowReplyView
) { EmptyView() }
AudioContentCommentItemView( AudioContentCommentItemView(
isDisabledNavigationLink: $isDisabledNavigationLink,
contentCreatorId: creatorId, contentCreatorId: creatorId,
audioContentId: audioContentId,
commentItem: comment, commentItem: comment,
isReplyComment: false, isReplyComment: false,
isShowPopupMenuButton: true, isShowPopupMenuButton: true,
@ -135,11 +124,6 @@ struct AudioContentCommentListView: View {
viewModel.getCommentList() viewModel.getCommentList()
} }
} }
.onTapGesture {
if !isDisabledNavigationLink {
isShowReplyView = true
}
}
} }
} }
} }

View File

@ -92,8 +92,8 @@ struct AudioContentListReplyView: View {
.padding(.horizontal, 13.3) .padding(.horizontal, 13.3)
AudioContentCommentItemView( AudioContentCommentItemView(
isDisabledNavigationLink: .constant(false),
contentCreatorId: creatorId, contentCreatorId: creatorId,
audioContentId: audioContentId,
commentItem: parentComment, commentItem: parentComment,
isReplyComment: true, isReplyComment: true,
isShowPopupMenuButton: false, isShowPopupMenuButton: false,
@ -108,8 +108,8 @@ struct AudioContentListReplyView: View {
ForEach(0..<viewModel.commentList.count, id: \.self) { index in ForEach(0..<viewModel.commentList.count, id: \.self) { index in
let comment = viewModel.commentList[index] let comment = viewModel.commentList[index]
AudioContentCommentItemView( AudioContentCommentItemView(
isDisabledNavigationLink: .constant(false),
contentCreatorId: creatorId, contentCreatorId: creatorId,
audioContentId: audioContentId,
commentItem: comment, commentItem: comment,
isReplyComment: true, isReplyComment: true,
isShowPopupMenuButton: true, isShowPopupMenuButton: true,