From 603fa0fcb9719db10af62be9ef2b0bec1d1085e7 Mon Sep 17 00:00:00 2001 From: sian7563 Date: Wed, 9 Nov 2022 15:59:25 +0900 Subject: [PATCH 01/10] =?UTF-8?q?feat=20::=20=EA=B3=B5=EC=A7=80=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=EB=B3=B4=EA=B8=B0=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Detail/NoticeDetailView.swift | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailView.swift diff --git a/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailView.swift b/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailView.swift new file mode 100644 index 00000000..8e228e6f --- /dev/null +++ b/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailView.swift @@ -0,0 +1,38 @@ +import DesignSystem +import SwiftUI + +struct NoticeDetailView: View { + @StateObject var viewModel: NoticeDetailViewModel + + var body: some View { + NavigationView { + VStack { + VStack(alignment: .leading, spacing: 24) { + Text("공지 제목") + .dmsFont(.title(.small), color: .GrayScale.gray7) + .padding(.top, 40) + + Divider() + } + HStack(alignment: .bottom) { + Text(""" +동해 물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라 만세 무궁화 삼천리 화려 강산 대한 사람, 대한으로 길이 보전하세 남산 위에 저 소나무, 철갑을 두른 듯바람 서리 불변함은 우리 기상일세 무궁화 삼천리 화려 강산 대한 사람, 대한으로 길이 보전하세 +""") + .padding(.top, 24) + .padding(.bottom, 40) + + Text("22/01/21 8:29") + .dmsFont(.text(.extraSmall), color: .GrayScale.gray5) + + Spacer() + } + Spacer() + } + .navigationTitle("공지") + .navigationBarTitleDisplayMode(.inline) + .padding(.horizontal, 24) + Spacer() + } + Spacer() + } +} From 11c9e5d761fbdfb547d386fb7d5d508f0df399d6 Mon Sep 17 00:00:00 2001 From: sian7563 Date: Wed, 9 Nov 2022 16:01:22 +0900 Subject: [PATCH 02/10] =?UTF-8?q?feat=20:=20NoticeListComponent=EC=97=90?= =?UTF-8?q?=20DetailComponent=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/NoticeList/NoticeListComponent.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListComponent.swift b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListComponent.swift index e1ce6342..2bfd073d 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListComponent.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListComponent.swift @@ -4,6 +4,7 @@ import SwiftUI public protocol NoticeListDependency: Dependency { var fetchNoticeListUseCase: any FetchNoticeListUseCase { get } + var noticeDetailComponent: NoticeDetailComponent { get } } public final class NoticeListComponent: Component { @@ -11,7 +12,8 @@ public final class NoticeListComponent: Component { NoticeListView( viewModel: .init( fetchNoticeListUseCase: dependency.fetchNoticeListUseCase - ) + ), + noticeDetailComponent: dependency.noticeDetailComponent ) } } From e7064e1e9aed07488ad5e586b142d5c696dac0a0 Mon Sep 17 00:00:00 2001 From: sian7563 Date: Wed, 9 Nov 2022 16:02:28 +0900 Subject: [PATCH 03/10] =?UTF-8?q?feat=20::=20NoticeListView=20navigation?= =?UTF-8?q?=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/NoticeList/NoticeListView.swift | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListView.swift b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListView.swift index 99c9009e..71d677b7 100644 --- a/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListView.swift +++ b/Projects/Features/NoticeFeature/Sources/NoticeList/NoticeListView.swift @@ -4,11 +4,14 @@ import SwiftUI struct NoticeListView: View { @StateObject var viewModel: NoticeListViewModel + private let noticeDetailComponent: NoticeDetailComponent init( - viewModel: NoticeListViewModel + viewModel: NoticeListViewModel, + noticeDetailComponent: NoticeDetailComponent ) { _viewModel = StateObject(wrappedValue: viewModel) + self.noticeDetailComponent = noticeDetailComponent } var body: some View { @@ -30,13 +33,14 @@ struct NoticeListView: View { .frame(height: 10) ForEach(viewModel.noticeList, id: \.self) { noticeList in - noticeListCellView( - title: noticeList.title, - content: noticeList.createdAt.toSmallDMSDateString() - ) - .padding(.top, 5) - .listRowInsets(EdgeInsets()) - + NavigationLink(destination: noticeDetailComponent.makeView(id: noticeList.id)) { + noticeListCellView( + title: noticeList.title, + content: noticeList.createdAt.toSmallDMSDateString() + ) + .padding(.top, 5) + .listRowInsets(EdgeInsets()) + } } } .padding(.horizontal, 24) @@ -45,6 +49,7 @@ struct NoticeListView: View { } .navigationTitle("공지") .navigationBarTitleDisplayMode(.inline) + .dmsBackground() } } From 016c74d901d66740c40625c43df8ee77c4346d48 Mon Sep 17 00:00:00 2001 From: sian7563 Date: Wed, 9 Nov 2022 16:03:16 +0900 Subject: [PATCH 04/10] =?UTF-8?q?feat=20::=20NoticeDetailViewModel=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail/NoticeDetailViewModel.swift | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailViewModel.swift diff --git a/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailViewModel.swift b/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailViewModel.swift new file mode 100644 index 00000000..a9521d12 --- /dev/null +++ b/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailViewModel.swift @@ -0,0 +1,30 @@ +import BaseFeature +import UIKit +import Combine +import DomainModule + +final class NoticeDetailViewModel: BaseViewModel { + @Published var title = "" + @Published var content = "" + @Published var date = Date() + + let id: String + + private let fetchDetailNoticeUseCase: any FetchDetailNoticeUseCase + + init( + fetchDetailNoticeUseCase: any FetchDetailNoticeUseCase, + id: String + ) { + self.fetchDetailNoticeUseCase = fetchDetailNoticeUseCase + self.id = id + super.init() + + addCancellable( + fetchDetailNoticeUseCase.execute(id: id) + ) { [weak self] noticeDetail in + self?.title = noticeDetail.title + self?.content = noticeDetail.content + } + } +} From 77c7ba484df5211e21d69591c6f41c4e134c4baa Mon Sep 17 00:00:00 2001 From: sian7563 Date: Wed, 9 Nov 2022 16:03:44 +0900 Subject: [PATCH 05/10] =?UTF-8?q?feat=20::=20=EA=B3=B5=EC=A7=80=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Detail/NoticeDetailView.swift | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailView.swift b/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailView.swift index 8e228e6f..964b2c9a 100644 --- a/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailView.swift +++ b/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailView.swift @@ -1,38 +1,40 @@ import DesignSystem import SwiftUI +import Utility struct NoticeDetailView: View { @StateObject var viewModel: NoticeDetailViewModel + @Environment(\.dismiss) var dismiss var body: some View { - NavigationView { - VStack { - VStack(alignment: .leading, spacing: 24) { - Text("공지 제목") - .dmsFont(.title(.small), color: .GrayScale.gray7) - .padding(.top, 40) + VStack { + VStack(alignment: .leading, spacing: 24) { + Text(viewModel.title) + .dmsFont(.title(.small), color: .GrayScale.gray7) + .padding(.top, 40) - Divider() - } - HStack(alignment: .bottom) { - Text(""" -동해 물과 백두산이 마르고 닳도록 하느님이 보우하사 우리나라 만세 무궁화 삼천리 화려 강산 대한 사람, 대한으로 길이 보전하세 남산 위에 저 소나무, 철갑을 두른 듯바람 서리 불변함은 우리 기상일세 무궁화 삼천리 화려 강산 대한 사람, 대한으로 길이 보전하세 -""") + Divider() + } + VStack(alignment: .leading, spacing: 24) { + Text(viewModel.content) .padding(.top, 24) .padding(.bottom, 40) - Text("22/01/21 8:29") - .dmsFont(.text(.extraSmall), color: .GrayScale.gray5) - + HStack { Spacer() + + Text(viewModel.date.toDMSDateString()) + .dmsFont(.text(.extraSmall), color: .GrayScale.gray5) + .frame(alignment: .trailing) } - Spacer() } - .navigationTitle("공지") - .navigationBarTitleDisplayMode(.inline) - .padding(.horizontal, 24) + Spacer() } + .navigationTitle("공지") + .navigationBarTitleDisplayMode(.inline) + .padding(.horizontal, 24) + Spacer() } } From 5b77f26f04c474f5f6a123b583e0aaffecfd5d1b Mon Sep 17 00:00:00 2001 From: sian7563 Date: Wed, 9 Nov 2022 16:04:05 +0900 Subject: [PATCH 06/10] =?UTF-8?q?feat=20::=20NoticeDetailComponent=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Detail/NoticeDetailComponent.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailComponent.swift diff --git a/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailComponent.swift b/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailComponent.swift new file mode 100644 index 00000000..016ffaf4 --- /dev/null +++ b/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailComponent.swift @@ -0,0 +1,18 @@ +import DomainModule +import NeedleFoundation +import SwiftUI + +public protocol NoticeDetailDependency: Dependency { + var fetchDetailNoticeUseCase: any FetchDetailNoticeUseCase { get } +} + +public final class NoticeDetailComponent: Component { + public func makeView(id: String) -> some View { + NoticeDetailView( + viewModel: .init( + fetchDetailNoticeUseCase: self.dependency.fetchDetailNoticeUseCase, + id: id + ) + ) + } +} From 7ba3d6ab3f450259b4806708f46987dfce098f63 Mon Sep 17 00:00:00 2001 From: sian7563 Date: Wed, 9 Nov 2022 16:04:35 +0900 Subject: [PATCH 07/10] =?UTF-8?q?feat=20::=20AppComponent=EC=97=90=20Notic?= =?UTF-8?q?eDetailComponent=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/App/Sources/Application/DI/AppComponent.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Projects/App/Sources/Application/DI/AppComponent.swift b/Projects/App/Sources/Application/DI/AppComponent.swift index cd3ec4d4..09d17080 100644 --- a/Projects/App/Sources/Application/DI/AppComponent.swift +++ b/Projects/App/Sources/Application/DI/AppComponent.swift @@ -88,4 +88,7 @@ public extension AppComponent { var myPageComponent: MyPageComponent { MyPageComponent(parent: self) } + var noticeDetailComponent: NoticeDetailComponent { + NoticeDetailComponent(parent: self) + } } From dd6d4a6841da4b982eb3daab9fc0097ad3f660db Mon Sep 17 00:00:00 2001 From: sian7563 Date: Wed, 9 Nov 2022 16:04:50 +0900 Subject: [PATCH 08/10] feat :: NeedleGenerated --- .../Sources/Application/NeedleGenerated.swift | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Projects/App/Sources/Application/NeedleGenerated.swift b/Projects/App/Sources/Application/NeedleGenerated.swift index 150b0c1d..aedf8f2d 100644 --- a/Projects/App/Sources/Application/NeedleGenerated.swift +++ b/Projects/App/Sources/Application/NeedleGenerated.swift @@ -309,6 +309,9 @@ private class NoticeListDependency0e93eb53be8626c408e4Provider: NoticeListDepend var fetchNoticeListUseCase: any FetchNoticeListUseCase { return appComponent.fetchNoticeListUseCase } + var noticeDetailComponent: NoticeDetailComponent { + return appComponent.noticeDetailComponent + } private let appComponent: AppComponent init(appComponent: AppComponent) { self.appComponent = appComponent @@ -318,6 +321,19 @@ private class NoticeListDependency0e93eb53be8626c408e4Provider: NoticeListDepend private func factorye14e687c08985bdffcd0f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { return NoticeListDependency0e93eb53be8626c408e4Provider(appComponent: parent1(component) as! AppComponent) } +private class NoticeDetailDependency714af3aed40eaebda420Provider: NoticeDetailDependency { + var fetchDetailNoticeUseCase: any FetchDetailNoticeUseCase { + return appComponent.fetchDetailNoticeUseCase + } + private let appComponent: AppComponent + init(appComponent: AppComponent) { + self.appComponent = appComponent + } +} +/// ^->AppComponent->NoticeDetailComponent +private func factory3db143c2f80d621d5a7ff47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject { + return NoticeDetailDependency714af3aed40eaebda420Provider(appComponent: parent1(component) as! AppComponent) +} private class FindIDDependencyb481fe947a844cc29913Provider: FindIDDependency { var findIDUseCase: any FindIDUseCase { return appComponent.findIDUseCase @@ -366,6 +382,7 @@ extension AppComponent: Registration { localTable["applyComponent-ApplyComponent"] = { self.applyComponent as Any } localTable["noticeListComponent-NoticeListComponent"] = { self.noticeListComponent as Any } localTable["myPageComponent-MyPageComponent"] = { self.myPageComponent as Any } + localTable["noticeDetailComponent-NoticeDetailComponent"] = { self.noticeDetailComponent as Any } localTable["remoteNoticeDataSource-any RemoteNoticeDataSource"] = { self.remoteNoticeDataSource as Any } localTable["noticeRepository-any NoticeRepository"] = { self.noticeRepository as Any } localTable["fetchWhetherNewNoticeUseCase-any FetchWhetherNewNoticeUseCase"] = { self.fetchWhetherNewNoticeUseCase as Any } @@ -501,6 +518,12 @@ extension EnterInformationComponent: Registration { extension NoticeListComponent: Registration { public func registerItems() { keyPathToName[\NoticeListDependency.fetchNoticeListUseCase] = "fetchNoticeListUseCase-any FetchNoticeListUseCase" + keyPathToName[\NoticeListDependency.noticeDetailComponent] = "noticeDetailComponent-NoticeDetailComponent" + } +} +extension NoticeDetailComponent: Registration { + public func registerItems() { + keyPathToName[\NoticeDetailDependency.fetchDetailNoticeUseCase] = "fetchDetailNoticeUseCase-any FetchDetailNoticeUseCase" } } extension FindIDComponent: Registration { @@ -544,6 +567,7 @@ private func register1() { registerProviderFactory("^->AppComponent->ChangePasswordComponent", factoryab7c4d87dab53e0a51b9f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->EnterInformationComponent", factory359a960501e79e833f64f47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->NoticeListComponent", factorye14e687c08985bdffcd0f47b58f8f304c97af4d5) + registerProviderFactory("^->AppComponent->NoticeDetailComponent", factory3db143c2f80d621d5a7ff47b58f8f304c97af4d5) registerProviderFactory("^->AppComponent->FindIDComponent", factory8dd2f9e0b545ead35ecaf47b58f8f304c97af4d5) } #endif From 407c62b1c1b36cf8550b8d508413beef5f6d5d8d Mon Sep 17 00:00:00 2001 From: sian7563 Date: Wed, 9 Nov 2022 16:18:49 +0900 Subject: [PATCH 09/10] =?UTF-8?q?feat=20::=20NoticeDetailViewModel=20?= =?UTF-8?q?=ED=94=BC=EB=93=9C=EB=B0=B1=20=EC=88=98=EC=A0=95=20date=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NoticeFeature/Sources/Detail/NoticeDetailViewModel.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailViewModel.swift b/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailViewModel.swift index a9521d12..84c203e3 100644 --- a/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailViewModel.swift +++ b/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailViewModel.swift @@ -25,6 +25,7 @@ final class NoticeDetailViewModel: BaseViewModel { ) { [weak self] noticeDetail in self?.title = noticeDetail.title self?.content = noticeDetail.content + self?.date = noticeDetail.createdAt } } } From d881322090c51e9c6516447ccb8c3434e0bdcbfe Mon Sep 17 00:00:00 2001 From: sian7563 Date: Wed, 9 Nov 2022 18:59:56 +0900 Subject: [PATCH 10/10] =?UTF-8?q?feat=20::=20stack=EB=B0=96=20=ED=95=84?= =?UTF-8?q?=EC=9A=94=EC=97=86=EB=8A=94=20Spacer=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NoticeFeature/Sources/Detail/NoticeDetailView.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailView.swift b/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailView.swift index 964b2c9a..0aeda9b7 100644 --- a/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailView.swift +++ b/Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailView.swift @@ -34,7 +34,5 @@ struct NoticeDetailView: View { .navigationTitle("공지") .navigationBarTitleDisplayMode(.inline) .padding(.horizontal, 24) - - Spacer() } }