refactor(navigation): 전역 경로 기반 단일 내비게이션 흐름으로 전환한다
This commit is contained in:
@@ -11,9 +11,10 @@ struct ContentListView: View {
|
||||
|
||||
let userId: Int
|
||||
@StateObject var viewModel = ContentListViewModel()
|
||||
@State private var isInitialized = false
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
Group {
|
||||
BaseView(isLoading: $viewModel.isLoading) {
|
||||
VStack(spacing: 0) {
|
||||
HStack(spacing: 0) {
|
||||
@@ -128,17 +129,14 @@ struct ContentListView: View {
|
||||
|
||||
ForEach(0..<viewModel.audioContentList.count, id: \.self) { index in
|
||||
let audioContent = viewModel.audioContentList[index]
|
||||
NavigationLink {
|
||||
ContentDetailView(contentId: audioContent.contentId)
|
||||
} label: {
|
||||
ContentListItemView(item: audioContent)
|
||||
.contentShape(Rectangle())
|
||||
.onAppear {
|
||||
if index == viewModel.audioContentList.count - 1 {
|
||||
viewModel.getAudioContentList()
|
||||
}
|
||||
ContentListItemView(item: audioContent)
|
||||
.contentShape(Rectangle())
|
||||
.onAppear {
|
||||
if index == viewModel.audioContentList.count - 1 {
|
||||
viewModel.getAudioContentList()
|
||||
}
|
||||
}
|
||||
}
|
||||
.onTapGesture { AppState.shared.setAppStep(step: .contentDetail(contentId: audioContent.contentId)) }
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 13.3)
|
||||
@@ -147,9 +145,12 @@ struct ContentListView: View {
|
||||
.padding(.top, 13.3)
|
||||
}
|
||||
.onAppear {
|
||||
viewModel.userId = userId
|
||||
viewModel.getCategoryList()
|
||||
viewModel.getAudioContentList()
|
||||
if !isInitialized || viewModel.userId != userId {
|
||||
viewModel.userId = userId
|
||||
viewModel.getCategoryList()
|
||||
viewModel.getAudioContentList()
|
||||
isInitialized = true
|
||||
}
|
||||
}
|
||||
.popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) {
|
||||
HStack {
|
||||
|
||||
Reference in New Issue
Block a user