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 }