Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Community/Sources/Presentation/Community/CommunityView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,15 @@ fileprivate struct CommunityFilterChip: View {
}

// MARK: - List View
struct CommunityListView: View {
public struct CommunityListView: View {
let boards: [Board]
let detailFactory: CommunityDetailFactory
let updateFactory: UpdateBoardFactory
let reportFactory: ReportBoardFactory

@State private var viewModel: CommunityViewModel

init(
public init(
boards: [Board],
detailFactory: CommunityDetailFactory,
updateFactory: UpdateBoardFactory,
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion Infrastructure/Sources/NetworkInterface/NetworkError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion MyPage/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
Expand Down
49 changes: 30 additions & 19 deletions MyPage/Sources/Presentation/MyActivitiesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand All @@ -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)
}
}

Expand All @@ -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))
Expand All @@ -284,8 +296,7 @@ fileprivate struct MyCommentActivityCard: View {
.truncationMode(.tail)
}
}
.padding(.horizontal, 16)
.padding(.vertical, 16)
.padding(16)
.background(Color.white)
}
}
Expand Down
Loading