From 15adbfe78175402f49cd14f7dc3d6a620f95cc46 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Tue, 22 Jul 2025 02:08:15 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A9=94=EC=9D=B8=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=20-=20=EC=95=88=20=EC=93=B0=EB=8A=94=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SodaLive/Sources/Live/LiveView.swift | 16 ++++++------ SodaLive/Sources/Live/LiveViewModel.swift | 31 +++-------------------- 2 files changed, 11 insertions(+), 36 deletions(-) diff --git a/SodaLive/Sources/Live/LiveView.swift b/SodaLive/Sources/Live/LiveView.swift index fb2ba6c..d6aeb16 100644 --- a/SodaLive/Sources/Live/LiveView.swift +++ b/SodaLive/Sources/Live/LiveView.swift @@ -73,14 +73,6 @@ struct LiveView: View { } ) - if viewModel.communityPostItems.count > 0 { - SectionCommunityPostView(items: viewModel.communityPostItems) - } - - if viewModel.recommendLiveItems.count > 0 { - SectionRecommendLiveView(items: viewModel.recommendLiveItems) - } - if viewModel.recommendChannelItems.count > 0 { SectionRecommendChannelView( items: viewModel.isFollowingList ? @@ -90,6 +82,14 @@ struct LiveView: View { ) } + if viewModel.communityPostItems.count > 0 { + SectionCommunityPostView(items: viewModel.communityPostItems) + } + + if viewModel.recommendLiveItems.count > 0 { + SectionRecommendLiveView(items: viewModel.recommendLiveItems) + } + SectionLiveReservationView( items: viewModel.liveReservationItems, onClickCancel: { viewModel.getSummary() }, diff --git a/SodaLive/Sources/Live/LiveViewModel.swift b/SodaLive/Sources/Live/LiveViewModel.swift index 5deab62..97c7e8e 100644 --- a/SodaLive/Sources/Live/LiveViewModel.swift +++ b/SodaLive/Sources/Live/LiveViewModel.swift @@ -11,12 +11,10 @@ import Combine final class LiveViewModel: ObservableObject { private let repository = LiveRepository() - private let eventRepository = EventRepository() private let liveRecommendRepository = LiveRecommendRepository() private let creatorCommunityRepository = CreatorCommunityRepository() private var subscription = Set() - @Published private(set) var eventBannerItems = [EventItem]() @Published private(set) var liveNowItems = [GetRoomListResponse]() @Published private(set) var liveReservationItems = [GetRoomListResponse]() @Published private(set) var recommendLiveItems: [GetRecommendLiveResponse] = [] @@ -97,7 +95,6 @@ final class LiveViewModel: ObservableObject { isLoading = true - eventBannerItems.removeAll() liveNowItems.removeAll() liveReservationItems.removeAll() @@ -123,10 +120,8 @@ final class LiveViewModel: ObservableObject { ) ) - let event = eventRepository.getEvents() - Publishers - .CombineLatest3(liveNow, liveReservation, event) + .CombineLatest(liveNow, liveReservation) .sink { result in switch result { case .finished: @@ -134,10 +129,9 @@ final class LiveViewModel: ObservableObject { case .failure(let error): ERROR_LOG(error.localizedDescription) } - } receiveValue: { (now, reservation, eventResponse) in + } receiveValue: { (now, reservation) in let nowData = now.data let reservationData = reservation.data - let eventData = eventResponse.data let jsonDecoder = JSONDecoder() @@ -178,26 +172,7 @@ final class LiveViewModel: ObservableObject { self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." self.isShowPopup = true } - - do { - let eventDecoded = try jsonDecoder.decode(ApiResponse.self, from: eventData) - if let data = eventDecoded.data, eventDecoded.success { - self.eventBannerItems.removeAll() - self.eventBannerItems.append(contentsOf: data.eventList) - } else { - if let message = eventDecoded.message { - self.errorMessage = message - } else { - self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." - } - - self.isShowPopup = true - } - } catch { - self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." - self.isShowPopup = true - } - + self.isLoading = false self.isRefresh = false }