From 57ac574bb9962f8b78062bc0643d44884df2615e Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Mon, 10 Aug 2026 18:43:43 +0900 Subject: [PATCH] =?UTF-8?q?fix(creator):=20=EC=83=81=EC=84=B8=20=EB=8C=93?= =?UTF-8?q?=EA=B8=80=20=EC=9E=A0=EA=B8=88=EC=9D=84=20=EC=A0=81=EC=9A=A9?= =?UTF-8?q?=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...reatorChannelCommunityPostDetailView.swift | 4 ++-- ...rChannelCommunityPostDetailViewModel.swift | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/SodaLive/Sources/V2/CreatorChannel/Community/Detail/CreatorChannelCommunityPostDetailView.swift b/SodaLive/Sources/V2/CreatorChannel/Community/Detail/CreatorChannelCommunityPostDetailView.swift index 1b39d8e8..d0e22b20 100644 --- a/SodaLive/Sources/V2/CreatorChannel/Community/Detail/CreatorChannelCommunityPostDetailView.swift +++ b/SodaLive/Sources/V2/CreatorChannel/Community/Detail/CreatorChannelCommunityPostDetailView.swift @@ -22,7 +22,7 @@ struct CreatorChannelCommunityPostDetailView: View { onTapPurchase: viewModel.presentPurchaseDialog ) - if detail.isCommentAvailable { + if viewModel.isCommentInteractionAvailable { Rectangle() .fill(Color.gray800) .frame(height: 1) @@ -83,7 +83,7 @@ struct CreatorChannelCommunityPostDetailView: View { viewModel.configure(postId: postId, onCommunityRefresh: onCommunityRefresh) } .safeAreaInset(edge: .bottom) { - if viewModel.detail?.isCommentAvailable == true { + if viewModel.isCommentInteractionAvailable { CreatorChannelCommunityPostDetailInputBar( text: $viewModel.commentText, isSecret: $viewModel.isSecret, diff --git a/SodaLive/Sources/V2/CreatorChannel/Community/Detail/CreatorChannelCommunityPostDetailViewModel.swift b/SodaLive/Sources/V2/CreatorChannel/Community/Detail/CreatorChannelCommunityPostDetailViewModel.swift index 118d6523..88bf2cb8 100644 --- a/SodaLive/Sources/V2/CreatorChannel/Community/Detail/CreatorChannelCommunityPostDetailViewModel.swift +++ b/SodaLive/Sources/V2/CreatorChannel/Community/Detail/CreatorChannelCommunityPostDetailViewModel.swift @@ -33,13 +33,18 @@ final class CreatorChannelCommunityPostDetailViewModel: ObservableObject { detail?.creatorId == UserDefaults.int(forKey: .userId) } + var isCommentInteractionAvailable: Bool { + guard let detail, detail.isCommentAvailable else { return false } + return detail.price <= 0 || detail.existOrdered || isOwnPost + } + var isShowSecret: Bool { guard let detail else { return false } return detail.price > 0 && detail.existOrdered && detail.creatorId != UserDefaults.int(forKey: .userId) } var isCommentSendEnabled: Bool { - guard detail?.isCommentAvailable == true else { return false } + guard isCommentInteractionAvailable else { return false } return commentText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == false && isLoading == false } @@ -102,7 +107,7 @@ final class CreatorChannelCommunityPostDetailViewModel: ObservableObject { func fetchNextCommentsIfNeeded(currentComment: CreatorChannelCommunityCommentResponse) { guard comments.last?.commentId == currentComment.commentId else { return } - guard detail?.isCommentAvailable == true else { return } + guard isCommentInteractionAvailable else { return } guard hasNext, isLoadingNextPage == false, isLoading == false else { return } guard postId > 0 else { return } @@ -227,7 +232,7 @@ final class CreatorChannelCommunityPostDetailViewModel: ObservableObject { } func sendComment() { - guard isCommentSendEnabled else { return } + guard isCommentInteractionAvailable, isCommentSendEnabled else { return } if let editingComment { modify(comment: editingComment) @@ -253,7 +258,7 @@ final class CreatorChannelCommunityPostDetailViewModel: ObservableObject { } func beginEditing(_ comment: CreatorChannelCommunityCommentResponse) { - guard canEdit(comment) else { return } + guard isCommentInteractionAvailable, canEdit(comment) else { return } selectedComment = nil editingComment = comment commentText = comment.content @@ -265,14 +270,14 @@ final class CreatorChannelCommunityPostDetailViewModel: ObservableObject { } func presentDeleteDialog(_ comment: CreatorChannelCommunityCommentResponse) { - guard canDelete(comment) else { return } + guard isCommentInteractionAvailable, canDelete(comment) else { return } selectedComment = nil deletingComment = comment isShowDeleteDialog = true } func confirmDelete() { - guard let deletingComment, isLoading == false else { return } + guard isCommentInteractionAvailable, let deletingComment, isLoading == false else { return } isShowDeleteDialog = false delete(comment: deletingComment) } @@ -284,7 +289,7 @@ final class CreatorChannelCommunityPostDetailViewModel: ObservableObject { hasNext = data.comments.hasNext hasLoaded = true - if data.isCommentAvailable { + if isCommentInteractionAvailable { comments = data.comments.comments } else { comments = []