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 {
|
if viewModel.recommendChannelItems.count > 0 {
|
||||||
SectionRecommendChannelView(
|
SectionRecommendChannelView(
|
||||||
items: viewModel.isFollowingList ?
|
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(
|
SectionLiveReservationView(
|
||||||
items: viewModel.liveReservationItems,
|
items: viewModel.liveReservationItems,
|
||||||
onClickCancel: { viewModel.getSummary() },
|
onClickCancel: { viewModel.getSummary() },
|
||||||
|
|||||||
@@ -11,12 +11,10 @@ import Combine
|
|||||||
final class LiveViewModel: ObservableObject {
|
final class LiveViewModel: ObservableObject {
|
||||||
|
|
||||||
private let repository = LiveRepository()
|
private let repository = LiveRepository()
|
||||||
private let eventRepository = EventRepository()
|
|
||||||
private let liveRecommendRepository = LiveRecommendRepository()
|
private let liveRecommendRepository = LiveRecommendRepository()
|
||||||
private let creatorCommunityRepository = CreatorCommunityRepository()
|
private let creatorCommunityRepository = CreatorCommunityRepository()
|
||||||
private var subscription = Set<AnyCancellable>()
|
private var subscription = Set<AnyCancellable>()
|
||||||
|
|
||||||
@Published private(set) var eventBannerItems = [EventItem]()
|
|
||||||
@Published private(set) var liveNowItems = [GetRoomListResponse]()
|
@Published private(set) var liveNowItems = [GetRoomListResponse]()
|
||||||
@Published private(set) var liveReservationItems = [GetRoomListResponse]()
|
@Published private(set) var liveReservationItems = [GetRoomListResponse]()
|
||||||
@Published private(set) var recommendLiveItems: [GetRecommendLiveResponse] = []
|
@Published private(set) var recommendLiveItems: [GetRecommendLiveResponse] = []
|
||||||
@@ -97,7 +95,6 @@ final class LiveViewModel: ObservableObject {
|
|||||||
|
|
||||||
isLoading = true
|
isLoading = true
|
||||||
|
|
||||||
eventBannerItems.removeAll()
|
|
||||||
liveNowItems.removeAll()
|
liveNowItems.removeAll()
|
||||||
liveReservationItems.removeAll()
|
liveReservationItems.removeAll()
|
||||||
|
|
||||||
@@ -123,10 +120,8 @@ final class LiveViewModel: ObservableObject {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
let event = eventRepository.getEvents()
|
|
||||||
|
|
||||||
Publishers
|
Publishers
|
||||||
.CombineLatest3(liveNow, liveReservation, event)
|
.CombineLatest(liveNow, liveReservation)
|
||||||
.sink { result in
|
.sink { result in
|
||||||
switch result {
|
switch result {
|
||||||
case .finished:
|
case .finished:
|
||||||
@@ -134,10 +129,9 @@ final class LiveViewModel: ObservableObject {
|
|||||||
case .failure(let error):
|
case .failure(let error):
|
||||||
ERROR_LOG(error.localizedDescription)
|
ERROR_LOG(error.localizedDescription)
|
||||||
}
|
}
|
||||||
} receiveValue: { (now, reservation, eventResponse) in
|
} receiveValue: { (now, reservation) in
|
||||||
let nowData = now.data
|
let nowData = now.data
|
||||||
let reservationData = reservation.data
|
let reservationData = reservation.data
|
||||||
let eventData = eventResponse.data
|
|
||||||
|
|
||||||
let jsonDecoder = JSONDecoder()
|
let jsonDecoder = JSONDecoder()
|
||||||
|
|
||||||
@@ -178,26 +172,7 @@ final class LiveViewModel: ObservableObject {
|
|||||||
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
|
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
|
||||||
self.isShowPopup = true
|
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.isLoading = false
|
||||||
self.isRefresh = false
|
self.isRefresh = false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user