Skip to content

Commit

Permalink
[Feat] #472 - NavigationCurationType 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
JIWON1923 committed Jun 25, 2023
1 parent 949476c commit 7a1afe9
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 41 deletions.
6 changes: 3 additions & 3 deletions HappyAnding/HappyAnding/Extensions/View/View+Navigation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
15 changes: 0 additions & 15 deletions HappyAnding/HappyAnding/Model/NavigationStackModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 1 addition & 3 deletions HappyAnding/HappyAnding/Views/TabView/ShortcutTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 7a1afe9

Please sign in to comment.