Skip to content

Commit 49ca2a7

Browse files
authored
Merge pull request #362 from Team-Capple/feat/#360-AnswerCommentList
2 parents 8b01e87 + db2f877 commit 49ca2a7

File tree

14 files changed

+952
-10
lines changed

14 files changed

+952
-10
lines changed

Qapple/Qapple/SourceCode/App/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extension AppDelegate {
2929
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
3030
) -> Bool {
3131
#if DEBUG
32-
RepositoryService.shared.configureServer(to: .production)
32+
RepositoryService.shared.configureServer(to: .test)
3333
#else
3434
RepositoryService.shared.configureServer(to: .production)
3535
#endif
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// AnswerComment.swift
3+
// Qapple
4+
//
5+
// Created by 문인범 on 4/14/25.
6+
//
7+
8+
import Foundation
9+
10+
// MARK: 임시 Entity
11+
struct AnswerComment: Identifiable, Equatable {
12+
let id: Int
13+
let writeId: Int
14+
let writerGeneration: String
15+
let content: String
16+
var heartCount: Int
17+
var isLiked: Bool
18+
let isMine: Bool
19+
var isReport: Bool
20+
let createdAt: Date
21+
22+
var anonymityId: Int
23+
}

Qapple/Qapple/SourceCode/Entity/DataType.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ enum DataType: Equatable {
1212
case answer(Answer)
1313
case bulletinBoard(BulletinBoard)
1414
case comment(BoardComment)
15+
case answerComment(AnswerComment)
1516
}

Qapple/Qapple/SourceCode/Feature/1.MainFlow/MainFlowFeature.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ struct MainFlowFeature {
7474
state.path.append(.report(.init(dataType: dataType)))
7575
return .none
7676

77+
case let .questionTab(.todayQuestion((.answerCommentButtonTapped(answer)))):
78+
state.path.append(.answerCommentList(.init(answer: answer)))
79+
return .none
80+
7781
case let .bulletinBoardTab(.boardCellTapped(board)):
7882
state.path.append(.comment(.init(board: board)))
7983
return .none
@@ -137,6 +141,18 @@ struct MainFlowFeature {
137141
state.path.append(.report(.init(dataType: dataType)))
138142
return .none
139143

144+
case let .element(id: _, action: .answerList(.answerCommentButtonTapped(answer))):
145+
state.path.append(.answerCommentList(.init(answer: answer)))
146+
return .none
147+
148+
case let .element(id: _, action: .answerCommentList(.sheet(.presented(.seeMore(.reportButtonTapped(dataType)))))):
149+
state.path.append(.report(.init(dataType: dataType)))
150+
return .none
151+
152+
case let .element(id: _, action: .answerCommentList(.reportButtonTapped(answerComment))):
153+
state.path.append(.report(.init(dataType: .answerComment(answerComment))))
154+
return .none
155+
140156
case let .element(id: _, action: .bulletinBoardSearch(.sheet(.presented(.seeMore(.reportButtonTapped(dataType)))))):
141157
state.path.append(.report(.init(dataType: dataType)))
142158
return .none
@@ -207,6 +223,7 @@ extension MainFlowFeature {
207223
case writeAnswer(WriteAnswerFeature)
208224
case completeAnswer(CompleteAnswerFeature)
209225
case answerList(AnswerListFeature)
226+
case answerCommentList(AnswerCommentFeature)
210227
case bulletinBoard(BulletinBoardFeature)
211228
case bulletinBoardSearch(BulletinBoardSearchFeature)
212229
case bulletinBoardPost(BulletinBoardPostFeature)

Qapple/Qapple/SourceCode/Feature/1.MainFlow/MainFlowView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ struct MainFlowView: View {
4848
case let .writeAnswer(store): WriteAnswerView(store: store)
4949
case let .completeAnswer(store): CompleteAnswerView(store: store)
5050
case let .answerList(store): AnswerListView(store: store)
51+
case let .answerCommentList(store): AnswerCommentView(store: store)
5152
case let .bulletinBoard(store): BulletinBoardView(store: store)
5253
case let .bulletinBoardSearch(store): BulletinBoardSearchView(store: store)
5354
case let .bulletinBoardPost(store): BulletinBoardPostView(store: store)

Qapple/Qapple/SourceCode/Feature/2.QuestionTab/2-2.TodayQuestion/TodayQuestionFeature.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct TodayQuestionFeature {
3636
case questionButtonTapped(Question)
3737
case seeAllAnswerButtonTapped(Question)
3838
case seeMoreAnswerButtonTapped(Answer)
39+
case answerCommentButtonTapped(Answer)
3940
case questionTimerTick
4041
case cancelQuestionTimer
4142
case toggleLoading(Bool)
@@ -141,6 +142,9 @@ struct TodayQuestionFeature {
141142
case .cancelQuestionTimer:
142143
return .cancel(id: CancelID.questionTimer)
143144

145+
case .answerCommentButtonTapped:
146+
return .none
147+
144148
case let .sheet(.presented(.seeMore(.alert(.presented(.confirmDeletion(sheetData)))))):
145149
guard case let .answer(answer) = sheetData else { return .none }
146150
return .run { send in

Qapple/Qapple/SourceCode/Feature/2.QuestionTab/2-2.TodayQuestion/TodayQuestionView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ private struct AnswerPreviewList: View {
304304

305305
},
306306
commentAction: {
307-
307+
store.send(.answerCommentButtonTapped(answer))
308308
}
309309
)
310310
}

Qapple/Qapple/SourceCode/Feature/2.QuestionTab/2-6.AnswerList/AnswerListFeature.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ struct AnswerListFeature {
3333
case networkingFailed(Error)
3434
case seeMoreAction(Answer)
3535
case backButtonTapped
36+
case likeAnswerButtonTapped
37+
case answerCommentButtonTapped(Answer)
3638
case toggleLoading(Bool)
3739
case sheet(PresentationAction<Sheet.Action>)
3840
case alert(PresentationAction<Alert>)
@@ -113,6 +115,13 @@ struct AnswerListFeature {
113115
state.answerList = state.answerList.reversed().filter(UserDefaults.filterAnswerBlockedUser)
114116
return .none
115117

118+
case .likeAnswerButtonTapped:
119+
// TODO: 좋아요 기능 구현 필요
120+
return .none
121+
122+
case .answerCommentButtonTapped:
123+
return .none
124+
116125
case let .networkingFailed(error):
117126
HapticService.notification(type: .error)
118127
state.alert = .failedNetworking(with: error)

Qapple/Qapple/SourceCode/Feature/2.QuestionTab/2-6.AnswerList/AnswerListView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ private struct AnswerList: View {
141141
store.send(.seeMoreAction(answer))
142142
},
143143
likeAction: {
144-
144+
store.send(.likeAnswerButtonTapped)
145145
},
146146
commentAction: {
147-
147+
store.send(.answerCommentButtonTapped(answer))
148148
}
149149
)
150150
.configurePagination(

0 commit comments

Comments
 (0)