Skip to content

Commit 20aa48f

Browse files
authored
Merge pull request #31 from HambugDev/feature/myPageActivityRoute
[Feat] 활동내역 터치시 커뮤니티 상세로 이동
2 parents ff32a79 + f95b7e8 commit 20aa48f

File tree

5 files changed

+38
-24
lines changed

5 files changed

+38
-24
lines changed

Community/Sources/Presentation/Community/CommunityView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,15 @@ fileprivate struct CommunityFilterChip: View {
190190
}
191191

192192
// MARK: - List View
193-
struct CommunityListView: View {
193+
public struct CommunityListView: View {
194194
let boards: [Board]
195195
let detailFactory: CommunityDetailFactory
196196
let updateFactory: UpdateBoardFactory
197197
let reportFactory: ReportBoardFactory
198198

199199
@State private var viewModel: CommunityViewModel
200200

201-
init(
201+
public init(
202202
boards: [Board],
203203
detailFactory: CommunityDetailFactory,
204204
updateFactory: UpdateBoardFactory,
@@ -212,7 +212,7 @@ struct CommunityListView: View {
212212
self._viewModel = State(initialValue: viewModel)
213213
}
214214

215-
var body: some View {
215+
public var body: some View {
216216
ScrollView {
217217
LazyVStack(spacing: 0) {
218218
ForEach(Array(boards.enumerated()), id: \.element.id) { index, board in

Infrastructure/Sources/NetworkImpl/NetworkServiceImpl.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public final class NetworkServiceImpl: NetworkServiceInterface {
6060
guard let self = self else { throw NetworkError.networkError(NSError()) }
6161

6262
if let error = response.error {
63+
print("❌ Network Error: \(error.localizedDescription)")
6364
throw self.mapAlamofireError(error)
6465
}
6566

Infrastructure/Sources/NetworkInterface/NetworkError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public enum NetworkError: Error, LocalizedError {
3737
case .serverErrorWithMessage(let code, let message):
3838
return "서버 오류 (\(code)): \(message)"
3939
case .unauthorized:
40-
return "인증이 필요합니다."
40+
return "토큰이 만료되었습니다. 인증이 필요합니다."
4141
case .forbidden:
4242
return "접근이 금지되었습니다."
4343
case .notFound:

MyPage/Package.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ let package = Package(
7575
.product(name: "LocalizedString", package: "Common"),
7676
.product(name: "SharedUI", package: "Common"),
7777
.product(name: "DesignSystem", package: "Common"),
78-
.product(name: "CommunityDomain", package: "Community")
78+
.product(name: "CommunityDomain", package: "Community"),
79+
.product(name: "CommunityPresentation", package: "Community"),
80+
.product(name: "CommunityDI", package: "Community")
7981
],
8082
path: Config.presentation.path
8183
),

MyPage/Sources/Presentation/MyActivitiesView.swift

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ import DesignSystem
1010
import CommunityDomain
1111
import MyPageDomain
1212
import SharedUI
13+
import CommunityDI
14+
import CommunityPresentation
1315

1416
public struct MyActivitiesView: View {
1517
@State private var viewModel: MyActivitiesViewModel
1618

19+
private let communityDIContainer: CommunityDIContainer
20+
1721
public init(viewModel: MyActivitiesViewModel) {
1822
self._viewModel = State(initialValue: viewModel)
23+
self.communityDIContainer = .init(appContainer: .shared)
1924
}
2025

2126
public var body: some View {
@@ -62,19 +67,18 @@ public struct MyActivitiesView: View {
6267
@ViewBuilder
6368
private var contentView: some View {
6469
if viewModel.selectedTab == .posts {
65-
MyBoardsListView(
70+
CommunityListView(
6671
boards: viewModel.myBoards,
67-
isLoadingMore: viewModel.isLoadingMoreBoards,
68-
onLoadMore: { index in
69-
if index >= viewModel.myBoards.count - 3 {
70-
Task { await viewModel.loadMoreBoards() }
71-
}
72-
}
72+
detailFactory: communityDIContainer,
73+
updateFactory: communityDIContainer,
74+
reportFactory: communityDIContainer,
75+
viewModel: communityDIContainer.makeCommunityViewModel()
7376
)
7477
.padding(.horizontal, 20)
7578
.padding(.vertical, 12)
7679
} else {
7780
MyCommentsListView(
81+
communityDIContainer: communityDIContainer,
7882
comments: viewModel.myComments,
7983
isLoadingMore: viewModel.isLoadingMoreComments,
8084
onLoadMore: { index in
@@ -219,15 +223,22 @@ fileprivate struct MyBoardListCard: View {
219223

220224
// MARK: - 댓글 리스트 뷰
221225
struct MyCommentsListView: View {
226+
let communityDIContainer: CommunityDIContainer
222227
let comments: [MyCommentActivity]
223228
let isLoadingMore: Bool
224229
let onLoadMore: (Int) -> Void
225-
230+
226231
var body: some View {
227232
ScrollView {
228233
LazyVStack(spacing: 0) {
229234
ForEach(Array(comments.enumerated()), id: \.element.id) { index, comment in
230-
NavigationLink(destination: Text("Board Detail \(comment.boardId)")) {
235+
NavigationLink(
236+
destination: CommunityDetailView(
237+
viewModel: communityDIContainer.makeDetailViewModel(),
238+
boardId: Int(comment.boardId),
239+
updateFactory: communityDIContainer,
240+
reportFactory: communityDIContainer
241+
)) {
231242
MyCommentActivityCard(comment: comment)
232243
}
233244
.buttonStyle(PlainButtonStyle())
@@ -243,12 +254,12 @@ struct MyCommentsListView: View {
243254
.padding(.vertical, 16)
244255
}
245256
}
257+
.cornerRadius(8)
258+
.shadow(color: Color.black.opacity(0.05), radius: 2, x: 0, y: 1)
246259
}
247-
.background(
248-
RoundedRectangle(cornerRadius: 8)
249-
.fill(Color.white)
250-
.shadow(color: Color.black.opacity(0.1), radius: 4.5, x: 0, y: 0)
251-
)
260+
.scrollIndicators(.hidden)
261+
.cornerRadius(8)
262+
.shadow(color: Color.black.opacity(0.05), radius: 2, x: 0, y: 1)
252263
}
253264
}
254265

@@ -273,9 +284,10 @@ fileprivate struct MyCommentActivityCard: View {
273284
}
274285

275286
HStack(spacing: 4) {
276-
Image("community_commnet", bundle: .main)
277-
.foregroundColor(Color.textG600)
278-
.font(.system(size: 12))
287+
Image("community_comment", bundle: .main)
288+
.resizable()
289+
.foregroundColor(.white)
290+
.frame(width: 12, height: 12)
279291

280292
Text(comment.content)
281293
.pretendard(.caption(.base))
@@ -284,8 +296,7 @@ fileprivate struct MyCommentActivityCard: View {
284296
.truncationMode(.tail)
285297
}
286298
}
287-
.padding(.horizontal, 16)
288-
.padding(.vertical, 16)
299+
.padding(16)
289300
.background(Color.white)
290301
}
291302
}

0 commit comments

Comments
 (0)