diff --git a/HappyAnding/HappyAnding/Extensions/View/View+Navigation.swift b/HappyAnding/HappyAnding/Extensions/View/View+Navigation.swift index 132c0e66..d3722e17 100644 --- a/HappyAnding/HappyAnding/Extensions/View/View+Navigation.swift +++ b/HappyAnding/HappyAnding/Extensions/View/View+Navigation.swift @@ -81,8 +81,8 @@ extension View { ListShortcutView(data: data as! NavigationListShortcutType) case is NavigationReadShortcutType: ReadShortcutView(data: data as! NavigationReadShortcutType) - case is NavigationReadCurationType: - ReadCurationView(viewModel: ReadCurationViewModel(data: data as! NavigationReadCurationType)) + case is Curation: + ReadCurationView(viewModel: ReadCurationViewModel(data: data as! Curation)) case is CurationType: ListCurationView(viewModel: ListCurationViewModel(data: data as! CurationType)) case is NavigationProfile: @@ -118,7 +118,7 @@ struct NavigationViewModifier: ViewModifier { .navigationDestination(for: NavigationProfile.self) { data in ShowProfileView(data: data) } - .navigationDestination(for: NavigationReadCurationType.self) { data in + .navigationDestination(for: Curation.self) { data in ReadCurationView(viewModel: ReadCurationViewModel(data: data)) } .navigationDestination(for: CurationType.self) { data in diff --git a/HappyAnding/HappyAnding/Model/NavigationStackModel.swift b/HappyAnding/HappyAnding/Model/NavigationStackModel.swift index 0a4d41a7..5760ec24 100644 --- a/HappyAnding/HappyAnding/Model/NavigationStackModel.swift +++ b/HappyAnding/HappyAnding/Model/NavigationStackModel.swift @@ -23,21 +23,6 @@ struct NavigationReadShortcutType: Identifiable, Hashable { let navigationParentView: NavigationParentView } -struct NavigationReadCurationType: Identifiable, Hashable { - var id = UUID().uuidString - - var isAdmin: Bool = false - let curation: Curation - let navigationParentView: NavigationParentView -} - -struct NavigationListCurationType: Identifiable, Hashable { - var id = UUID().uuidString - - var type: CurationType - let navigationParentView: NavigationParentView -} - struct NavigationProfile: Identifiable, Hashable { var id = UUID().uuidString diff --git a/HappyAnding/HappyAnding/ViewModel/ExploreCurationViewModels/ReadCurationViewModel.swift b/HappyAnding/HappyAnding/ViewModel/ExploreCurationViewModels/ReadCurationViewModel.swift index e8d569e2..8706259b 100644 --- a/HappyAnding/HappyAnding/ViewModel/ExploreCurationViewModels/ReadCurationViewModel.swift +++ b/HappyAnding/HappyAnding/ViewModel/ExploreCurationViewModels/ReadCurationViewModel.swift @@ -19,9 +19,10 @@ final class ReadCurationViewModel: ObservableObject { @Published var gradeImage = Image(systemName: "person.crop.circle.fill") @Published private(set) var isAdmin = false - init(data: NavigationReadCurationType) { - self.curation = data.curation + init(data: Curation) { + self.curation = data self.authInformation = User() + self.isAdmin = curation.isAdmin fetchUserGrade() } diff --git a/HappyAnding/HappyAnding/Views/Components/UserCurationListView.swift b/HappyAnding/HappyAnding/Views/Components/UserCurationListView.swift index 1f5139c1..2e45eae7 100644 --- a/HappyAnding/HappyAnding/Views/Components/UserCurationListView.swift +++ b/HappyAnding/HappyAnding/Views/Components/UserCurationListView.swift @@ -59,12 +59,10 @@ struct UserCurationListView: View { ForEach(Array(shortcutsZipViewModel.curationsMadeByUser.enumerated()), id: \.offset) { index, curation in if index < 2 { - let data = NavigationReadCurationType(curation: curation, - navigationParentView: .curations) UserCurationCell(curation: curation, lineLimit: 2, navigationParentView: .curations) - .navigationLinkRouter(data: data) + .navigationLinkRouter(data: curation) } } diff --git a/HappyAnding/HappyAnding/Views/ExploreCurationViews/ExploreCurationView.swift b/HappyAnding/HappyAnding/Views/ExploreCurationViews/ExploreCurationView.swift index eeb34765..86e29f7f 100644 --- a/HappyAnding/HappyAnding/Views/ExploreCurationViews/ExploreCurationView.swift +++ b/HappyAnding/HappyAnding/Views/ExploreCurationViews/ExploreCurationView.swift @@ -46,9 +46,7 @@ struct ExploreCurationView: View { HStack(spacing: 0) { ForEach(viewModel.adminCurationList, id: \.id) { curation in AdminCurationCell(adminCuration: curation) - .navigationLinkRouter(data: NavigationReadCurationType(isAdmin: true, - curation: curation, - navigationParentView: .curations)) + .navigationLinkRouter(data: curation) } } .padding(.trailing, 8) @@ -74,13 +72,11 @@ struct ExploreCurationView: View { .padding(.horizontal, 16) ForEach(viewModel.getCurationList(with:sectionType).prefix(2), id: \.self) { curation in - let data = NavigationReadCurationType(curation: curation, - navigationParentView: .curations) UserCurationCell(curation: curation, lineLimit: 2, navigationParentView: .curations) - .navigationLinkRouter(data: data) + .navigationLinkRouter(data: curation) } } } diff --git a/HappyAnding/HappyAnding/Views/ExploreCurationViews/ListCurationView.swift b/HappyAnding/HappyAnding/Views/ExploreCurationViews/ListCurationView.swift index 1caa61c7..70f0dcc8 100644 --- a/HappyAnding/HappyAnding/Views/ExploreCurationViews/ListCurationView.swift +++ b/HappyAnding/HappyAnding/Views/ExploreCurationViews/ListCurationView.swift @@ -51,14 +51,10 @@ struct ListCurationView: View { private func makeCurationCellList(_ curations: [Curation]) -> some View { ForEach(Array(curations.enumerated()), id: \.offset) { index, curation in - // TODO: ReadcurationViewModels과 통합 - let data = NavigationReadCurationType(curation: curation, - navigationParentView: .curations) - UserCurationCell(curation: curation, lineLimit: 2, navigationParentView: .curations) - .navigationLinkRouter(data: data) + .navigationLinkRouter(data: curation) .listRowInsets(EdgeInsets()) .listRowSeparator(.hidden) .listRowBackground(Color.shortcutsZipBackground) diff --git a/HappyAnding/HappyAnding/Views/ReadShortcutViews/ShowProfileView.swift b/HappyAnding/HappyAnding/Views/ReadShortcutViews/ShowProfileView.swift index 652b1a46..3fc3a211 100644 --- a/HappyAnding/HappyAnding/Views/ReadShortcutViews/ShowProfileView.swift +++ b/HappyAnding/HappyAnding/Views/ReadShortcutViews/ShowProfileView.swift @@ -165,12 +165,11 @@ extension ShowProfileView { VStack(spacing: 0) { ForEach(curations, id: \.self) { curation in - let data = NavigationReadCurationType(curation: curation, - navigationParentView: .shortcuts) + // TODO: navigation parent view 삭제 UserCurationCell(curation: curation, lineLimit: 2, - navigationParentView: data.navigationParentView) - .navigationLinkRouter(data: data) + navigationParentView: .curations) + .navigationLinkRouter(data: curation) } Spacer() diff --git a/HappyAnding/HappyAnding/Views/TabView/ShortcutTabView.swift b/HappyAnding/HappyAnding/Views/TabView/ShortcutTabView.swift index e0e4c94f..db91ece5 100644 --- a/HappyAnding/HappyAnding/Views/TabView/ShortcutTabView.swift +++ b/HappyAnding/HappyAnding/Views/TabView/ShortcutTabView.swift @@ -175,9 +175,7 @@ struct ShortcutTabView: View { isCurationDeeplink = true if let curation = shortcutsZipViewModel.fetchCurationDetail(curationID: tempCurationId) { - let data = NavigationReadCurationType(curation: curation, - navigationParentView: .myPage) - navigateLink(data: data) + navigateLink(data: curation) } }