From f95b7e8a126c935f465e51b1d6b40016697e01c0 Mon Sep 17 00:00:00 2001 From: kangddong Date: Tue, 13 Jan 2026 00:09:15 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=99=9C=EB=8F=99=EB=82=B4=EC=97=AD=20?= =?UTF-8?q?=ED=84=B0=EC=B9=98=EC=8B=9C=20=EC=BB=A4=EB=AE=A4=EB=8B=88?= =?UTF-8?q?=ED=8B=B0=20=EC=83=81=EC=84=B8=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Community/CommunityView.swift | 6 +-- .../NetworkImpl/NetworkServiceImpl.swift | 1 + .../NetworkInterface/NetworkError.swift | 2 +- MyPage/Package.swift | 4 +- .../Presentation/MyActivitiesView.swift | 49 ++++++++++++------- 5 files changed, 38 insertions(+), 24 deletions(-) diff --git a/Community/Sources/Presentation/Community/CommunityView.swift b/Community/Sources/Presentation/Community/CommunityView.swift index 8410842..900d888 100644 --- a/Community/Sources/Presentation/Community/CommunityView.swift +++ b/Community/Sources/Presentation/Community/CommunityView.swift @@ -190,7 +190,7 @@ fileprivate struct CommunityFilterChip: View { } // MARK: - List View -struct CommunityListView: View { +public struct CommunityListView: View { let boards: [Board] let detailFactory: CommunityDetailFactory let updateFactory: UpdateBoardFactory @@ -198,7 +198,7 @@ struct CommunityListView: View { @State private var viewModel: CommunityViewModel - init( + public init( boards: [Board], detailFactory: CommunityDetailFactory, updateFactory: UpdateBoardFactory, @@ -212,7 +212,7 @@ struct CommunityListView: View { self._viewModel = State(initialValue: viewModel) } - var body: some View { + public var body: some View { ScrollView { LazyVStack(spacing: 0) { ForEach(Array(boards.enumerated()), id: \.element.id) { index, board in diff --git a/Infrastructure/Sources/NetworkImpl/NetworkServiceImpl.swift b/Infrastructure/Sources/NetworkImpl/NetworkServiceImpl.swift index d6e9950..ccb2460 100644 --- a/Infrastructure/Sources/NetworkImpl/NetworkServiceImpl.swift +++ b/Infrastructure/Sources/NetworkImpl/NetworkServiceImpl.swift @@ -60,6 +60,7 @@ public final class NetworkServiceImpl: NetworkServiceInterface { guard let self = self else { throw NetworkError.networkError(NSError()) } if let error = response.error { + print("❌ Network Error: \(error.localizedDescription)") throw self.mapAlamofireError(error) } diff --git a/Infrastructure/Sources/NetworkInterface/NetworkError.swift b/Infrastructure/Sources/NetworkInterface/NetworkError.swift index ee1c544..bee70cc 100644 --- a/Infrastructure/Sources/NetworkInterface/NetworkError.swift +++ b/Infrastructure/Sources/NetworkInterface/NetworkError.swift @@ -37,7 +37,7 @@ public enum NetworkError: Error, LocalizedError { case .serverErrorWithMessage(let code, let message): return "서버 오류 (\(code)): \(message)" case .unauthorized: - return "인증이 필요합니다." + return "토큰이 만료되었습니다. 인증이 필요합니다." case .forbidden: return "접근이 금지되었습니다." case .notFound: diff --git a/MyPage/Package.swift b/MyPage/Package.swift index 4702b3a..f11068d 100644 --- a/MyPage/Package.swift +++ b/MyPage/Package.swift @@ -74,7 +74,9 @@ let package = Package( .target(config: .domain), .product(name: "LocalizedString", package: "Common"), .product(name: "DesignSystem", package: "Common"), - .product(name: "CommunityDomain", package: "Community") + .product(name: "CommunityDomain", package: "Community"), + .product(name: "CommunityPresentation", package: "Community"), + .product(name: "CommunityDI", package: "Community") ], path: Config.presentation.path ), diff --git a/MyPage/Sources/Presentation/MyActivitiesView.swift b/MyPage/Sources/Presentation/MyActivitiesView.swift index ab24dca..73a5a75 100644 --- a/MyPage/Sources/Presentation/MyActivitiesView.swift +++ b/MyPage/Sources/Presentation/MyActivitiesView.swift @@ -10,12 +10,17 @@ import DesignSystem import CommunityDomain import MyPageDomain import SharedUI +import CommunityDI +import CommunityPresentation public struct MyActivitiesView: View { @State private var viewModel: MyActivitiesViewModel + private let communityDIContainer: CommunityDIContainer + public init(viewModel: MyActivitiesViewModel) { self._viewModel = State(initialValue: viewModel) + self.communityDIContainer = .init(appContainer: .shared) } public var body: some View { @@ -62,19 +67,18 @@ public struct MyActivitiesView: View { @ViewBuilder private var contentView: some View { if viewModel.selectedTab == .posts { - MyBoardsListView( + CommunityListView( boards: viewModel.myBoards, - isLoadingMore: viewModel.isLoadingMoreBoards, - onLoadMore: { index in - if index >= viewModel.myBoards.count - 3 { - Task { await viewModel.loadMoreBoards() } - } - } + detailFactory: communityDIContainer, + updateFactory: communityDIContainer, + reportFactory: communityDIContainer, + viewModel: communityDIContainer.makeCommunityViewModel() ) .padding(.horizontal, 20) .padding(.vertical, 12) } else { MyCommentsListView( + communityDIContainer: communityDIContainer, comments: viewModel.myComments, isLoadingMore: viewModel.isLoadingMoreComments, onLoadMore: { index in @@ -219,15 +223,22 @@ fileprivate struct MyBoardListCard: View { // MARK: - 댓글 리스트 뷰 struct MyCommentsListView: View { + let communityDIContainer: CommunityDIContainer let comments: [MyCommentActivity] let isLoadingMore: Bool let onLoadMore: (Int) -> Void - + var body: some View { ScrollView { LazyVStack(spacing: 0) { ForEach(Array(comments.enumerated()), id: \.element.id) { index, comment in - NavigationLink(destination: Text("Board Detail \(comment.boardId)")) { + NavigationLink( + destination: CommunityDetailView( + viewModel: communityDIContainer.makeDetailViewModel(), + boardId: Int(comment.boardId), + updateFactory: communityDIContainer, + reportFactory: communityDIContainer + )) { MyCommentActivityCard(comment: comment) } .buttonStyle(PlainButtonStyle()) @@ -243,12 +254,12 @@ struct MyCommentsListView: View { .padding(.vertical, 16) } } + .cornerRadius(8) + .shadow(color: Color.black.opacity(0.05), radius: 2, x: 0, y: 1) } - .background( - RoundedRectangle(cornerRadius: 8) - .fill(Color.white) - .shadow(color: Color.black.opacity(0.1), radius: 4.5, x: 0, y: 0) - ) + .scrollIndicators(.hidden) + .cornerRadius(8) + .shadow(color: Color.black.opacity(0.05), radius: 2, x: 0, y: 1) } } @@ -273,9 +284,10 @@ fileprivate struct MyCommentActivityCard: View { } HStack(spacing: 4) { - Image("community_commnet", bundle: .main) - .foregroundColor(Color.textG600) - .font(.system(size: 12)) + Image("community_comment", bundle: .main) + .resizable() + .foregroundColor(.white) + .frame(width: 12, height: 12) Text(comment.content) .pretendard(.caption(.base)) @@ -284,8 +296,7 @@ fileprivate struct MyCommentActivityCard: View { .truncationMode(.tail) } } - .padding(.horizontal, 16) - .padding(.vertical, 16) + .padding(16) .background(Color.white) } }