-
Notifications
You must be signed in to change notification settings - Fork 1
[FEAT] 답변에 대한 댓글 기능 업데이트 #369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
28d0997
[#368] 인기 답변 UI 구현
mooninbeom b0294f3
[#368] Answer DTO 수정(좋아요, 댓글 count 추가)
mooninbeom e385aa0
[#368] AnswerCell 수정
mooninbeom 3f653f9
[#368] 답변 좋아요 기능 연결
mooninbeom 594f418
[#368] AnswerCommentRepository 구현
mooninbeom f69e7f2
[#368] CommentRepository -> BoardCommentRepository renaming
mooninbeom 3614b22
[#368] AnswerCommentFeature 구현
mooninbeom 4354e2b
[#368] GAService 추가(답변 좋아요, 댓글 관련)
mooninbeom 7b85cc7
[#368] MyPage의 내 답변 리스트에 좋아요, comment 연결
mooninbeom b8580b6
[#368] 인기 답변 로직 구현
mooninbeom f84d98f
[#368] AnswerCommentView 기능 연결
mooninbeom cf02f34
[#368] 패키지 업데이트 대응
mooninbeom 2c37258
[#368] 인기답변 추출 로직 수정(모든 질문에 사용 가능하도록)
mooninbeom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
Qapple/Qapple/Resource/Color/Colors.xcassets/GradientStroke/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
20 changes: 20 additions & 0 deletions
20
...le/Qapple/Resource/Color/Colors.xcassets/GradientStroke/popularEnd.colorset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "colors" : [ | ||
| { | ||
| "color" : { | ||
| "color-space" : "srgb", | ||
| "components" : { | ||
| "alpha" : "1.000", | ||
| "blue" : "0x61", | ||
| "green" : "0x42", | ||
| "red" : "0xEC" | ||
| } | ||
| }, | ||
| "idiom" : "universal" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
20 changes: 20 additions & 0 deletions
20
.../Qapple/Resource/Color/Colors.xcassets/GradientStroke/popularStart.colorset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "colors" : [ | ||
| { | ||
| "color" : { | ||
| "color-space" : "srgb", | ||
| "components" : { | ||
| "alpha" : "1.000", | ||
| "blue" : "0xC2", | ||
| "green" : "0xB5", | ||
| "red" : "0xFA" | ||
| } | ||
| }, | ||
| "idiom" : "universal" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
141 changes: 141 additions & 0 deletions
141
Qapple/Qapple/SourceCode/Data/Repository/AnswerCommentRepository.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| // | ||
| // AnswerCommentRepository.swift | ||
| // Qapple | ||
| // | ||
| // Created by 문인범 on 5/20/25. | ||
| // | ||
|
|
||
| import ComposableArchitecture | ||
| import QappleRepository | ||
| import Foundation | ||
|
|
||
|
|
||
| /** | ||
| AnswerComment API 의존성 | ||
| */ | ||
| struct AnswerCommentRepository { | ||
| var fetchAnswerComments: (_ answerId: Int) async throws -> [AnswerComment] | ||
| var createAnswerComment: (_ answerId: Int, _ content: String) async throws -> Void | ||
| var likeAnswerComment: (_ answerCommentId: Int) async throws -> Void | ||
| var deleteAnswerComment: (_ answerCommentId: Int) async throws -> Void | ||
| } | ||
|
|
||
|
|
||
| // MARK: - DependencyKey | ||
| extension AnswerCommentRepository: DependencyKey { | ||
| static let liveValue: AnswerCommentRepository = Self( | ||
| fetchAnswerComments: { answerId in | ||
| let response = try await RepositoryService.shared.request { server, accessToken in | ||
| try await AnswerCommentAPI.fetchAnswerComments( | ||
| answerId: answerId, | ||
| server: server, | ||
| accessToken: accessToken | ||
| ) | ||
| } | ||
|
|
||
| let list = response.answerCommentInfos.map { | ||
| AnswerComment( | ||
| id: $0.answerCommentId, | ||
| writeId: $0.writerId, | ||
| // TODO: 5/20 문의 필요(writer generation, isLiked, isMine, isReport이 있는지 여부) | ||
| writerGeneration: "", | ||
| content: $0.content, | ||
| heartCount: $0.heartCount, | ||
| isLiked: false, | ||
| isMine: false, | ||
| isReport: false, | ||
| createdAt: $0.createdAt.ISO8601ToDate(.yearMonthDateTimeMilliseconds), | ||
| anonymityId: -2 | ||
| ) | ||
| } | ||
|
|
||
| return list | ||
| }, | ||
| createAnswerComment: { answerId, content in | ||
| let _ = try await RepositoryService.shared.request { server, accessToken in | ||
| try await AnswerCommentAPI.createAnswerComment( | ||
| answerId: answerId, | ||
| content: content, | ||
| server: server, | ||
| accessToken: accessToken | ||
| ) | ||
| } | ||
| }, | ||
| likeAnswerComment: { answerCommentId in | ||
| let _ = try await RepositoryService.shared.request { server, accessToken in | ||
| try await AnswerCommentAPI.likeAnswerComment( | ||
| answerCommentId: answerCommentId, | ||
| server: server, | ||
| accessToken: accessToken | ||
| ) | ||
| } | ||
| }, | ||
| deleteAnswerComment: { answerCommentId in | ||
| let _ = try await RepositoryService.shared.request { server, accessToken in | ||
| try await AnswerCommentAPI.deleteAnswerComment( | ||
| answerCommentId: answerCommentId, | ||
| server: server, | ||
| accessToken: accessToken | ||
| ) | ||
| } | ||
| } | ||
| ) | ||
|
|
||
| static let previewValue: AnswerCommentRepository = .init( | ||
| fetchAnswerComments: { _ in | ||
| sampleComments | ||
| }, | ||
| createAnswerComment: { answerId, content in | ||
| print("\(answerId) 게시글에 \"\(content)\" 댓글을 작성했습니다.") | ||
| }, | ||
| likeAnswerComment: { answerCommentId in | ||
| print("\(answerCommentId) 댓글에 좋아요를 눌렀습니다.") | ||
| }, | ||
| deleteAnswerComment: { answerCommentId in | ||
| print("\(answerCommentId) 댓글을 삭제했습니다.") | ||
| } | ||
| ) | ||
|
|
||
| static let testValue: AnswerCommentRepository = .init( | ||
| fetchAnswerComments: { _ in | ||
| sampleComments | ||
| }, | ||
| createAnswerComment: { _, _ in }, | ||
| likeAnswerComment: { _ in }, | ||
| deleteAnswerComment: { _ in } | ||
| ) | ||
| } | ||
|
|
||
|
|
||
| // MARK: DependencyValues | ||
| extension DependencyValues { | ||
| var answerCommentRepository: AnswerCommentRepository { | ||
| get { self[AnswerCommentRepository.self] } | ||
| set { self[AnswerCommentRepository.self] = newValue } | ||
| } | ||
| } | ||
|
|
||
|
|
||
| // MARK: Test Values | ||
| extension AnswerCommentRepository { | ||
| private static let sampleComments: [AnswerComment] = { | ||
| var result = [AnswerComment]() | ||
| for i in 1...10 { | ||
| result.append( | ||
| AnswerComment( | ||
| id: i, | ||
| writeId: i, | ||
| writerGeneration: "4기", | ||
| content: "테스트 댓글\(i)", | ||
| heartCount: i, | ||
| isLiked: i == 1, | ||
| isMine: i == 2, | ||
| isReport: i == 3, | ||
| createdAt: .now, | ||
| anonymityId: -2 | ||
| ) | ||
| ) | ||
| } | ||
| return result | ||
| }() | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
체크 좋슴니다!