From 884952db5a504dcca8900541c83c0d1f56a15861 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Fri, 3 Jul 2026 16:10:10 +0900 Subject: [PATCH] =?UTF-8?q?feat(creator):=20=EC=BB=A4=EB=AE=A4=EB=8B=88?= =?UTF-8?q?=ED=8B=B0=20=EC=A2=8B=EC=95=84=EC=9A=94=EB=A5=BC=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreatorChannel/CreatorChannelView.swift | 3 ++- .../CreatorChannelViewModel.swift | 20 +++++++++++++++++++ .../Home/CreatorChannelHomeView.swift | 8 ++++++-- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/SodaLive/Sources/V2/CreatorChannel/CreatorChannelView.swift b/SodaLive/Sources/V2/CreatorChannel/CreatorChannelView.swift index 2a6df557..f72e64be 100644 --- a/SodaLive/Sources/V2/CreatorChannel/CreatorChannelView.swift +++ b/SodaLive/Sources/V2/CreatorChannel/CreatorChannelView.swift @@ -160,7 +160,8 @@ struct CreatorChannelView: View { onTapContent: showContentDetail, onTapDonate: showDonationDialog, onTapSchedule: handleScheduleTap, - onTapSeries: showSeriesDetail + onTapSeries: showSeriesDetail, + onTapCommunityLike: viewModel.likeCommunityPost ) } else { CreatorChannelPlaceholderTabView(title: viewModel.selectedTab.title) diff --git a/SodaLive/Sources/V2/CreatorChannel/CreatorChannelViewModel.swift b/SodaLive/Sources/V2/CreatorChannel/CreatorChannelViewModel.swift index e8975426..7a6496a8 100644 --- a/SodaLive/Sources/V2/CreatorChannel/CreatorChannelViewModel.swift +++ b/SodaLive/Sources/V2/CreatorChannel/CreatorChannelViewModel.swift @@ -4,6 +4,7 @@ import Combine final class CreatorChannelViewModel: ObservableObject { private let repository = CreatorChannelHomeRepository() private let userRepository = UserRepository() + private let communityRepository = CreatorCommunityRepository() private var subscription = Set() @Published var isLoading = false @@ -101,6 +102,25 @@ final class CreatorChannelViewModel: ObservableObject { .store(in: &subscription) } + func likeCommunityPost(postId: Int) { + guard postId > 0 else { return } + + communityRepository.communityPostLike(postId: postId) + .sink { [weak self] result in + guard let self else { return } + + switch result { + case .finished: + DEBUG_LOG("finish") + case .failure(let error): + ERROR_LOG(error.localizedDescription) + self.errorMessage = I18n.Common.commonError + self.isShowPopup = true + } + } receiveValue: { _ in } + .store(in: &subscription) + } + private func applyApiFailedPlaceholderState() { response = nil isApiFailedPlaceholderVisible = true diff --git a/SodaLive/Sources/V2/CreatorChannel/Home/CreatorChannelHomeView.swift b/SodaLive/Sources/V2/CreatorChannel/Home/CreatorChannelHomeView.swift index 8583b572..c0365571 100644 --- a/SodaLive/Sources/V2/CreatorChannel/Home/CreatorChannelHomeView.swift +++ b/SodaLive/Sources/V2/CreatorChannel/Home/CreatorChannelHomeView.swift @@ -8,6 +8,7 @@ struct CreatorChannelHomeView: View { let onTapDonate: () -> Void let onTapSchedule: (CreatorActivityType, Int) -> Void let onTapSeries: (Int) -> Void + let onTapCommunityLike: (Int) -> Void init( response: CreatorChannelHomeResponse, @@ -16,7 +17,8 @@ struct CreatorChannelHomeView: View { onTapContent: @escaping (Int) -> Void = { _ in }, onTapDonate: @escaping () -> Void = {}, onTapSchedule: @escaping (CreatorActivityType, Int) -> Void = { _, _ in }, - onTapSeries: @escaping (Int) -> Void = { _ in } + onTapSeries: @escaping (Int) -> Void = { _ in }, + onTapCommunityLike: @escaping (Int) -> Void = { _ in } ) { self.response = response self.onSelectTab = onSelectTab @@ -25,6 +27,7 @@ struct CreatorChannelHomeView: View { self.onTapDonate = onTapDonate self.onTapSchedule = onTapSchedule self.onTapSeries = onTapSeries + self.onTapCommunityLike = onTapCommunityLike } var body: some View { @@ -66,7 +69,8 @@ struct CreatorChannelHomeView: View { CreatorChannelCommunitySection( communities: response.communities, - onSelectTab: onSelectTab + onSelectTab: onSelectTab, + onTapLike: onTapCommunityLike ) } .frame(maxWidth: .infinity, alignment: .leading)