fix: 메인 라이브
- 안 쓰는 이벤트 코드 제거
This commit is contained in:
@@ -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() },
|
||||
|
||||
@@ -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<AnyCancellable>()
|
||||
|
||||
@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()
|
||||
|
||||
@@ -179,25 +173,6 @@ final class LiveViewModel: ObservableObject {
|
||||
self.isShowPopup = true
|
||||
}
|
||||
|
||||
do {
|
||||
let eventDecoded = try jsonDecoder.decode(ApiResponse<GetEventResponse>.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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user