-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/#393 공통퀘스트 삭제 API 연결 #405
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
11 commits
Select commit
Hold shift + click to select a range
6c5dd0e
feat: #393 공통퀘스트 삭제 API 연결
dev-domo d4d83f5
feat: #393 공통퀘스트 삭제 관련 의존성 주입
dev-domo dc15137
refactor: #393 delete 모달 타입 추가
dev-domo 5cb047f
refactor: #393 사용자 답변 작성 유무 추가
dev-domo 2f7db9c
refactor: #393 CommonQuestContenCell의 높이를 동적으로 설정
dev-domo 173afb3
refactor: #393 메서드 위치 수정 및 메서드 분리
dev-domo 9b1fb9d
refactor: #393 DateNavigator 날짜 형식 수정
dev-domo d730643
refactor: #393 CommonQuestContentCell 레이아웃 제약 수정
dev-domo 547f041
feat: #393 공통퀘스트 삭제 구독
dev-domo 08d995f
refactor: #393 모달 띄우기 구현
dev-domo 4138f4b
feat: #393 DeleteCommonQuestDelegate 구현
dev-domo 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
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
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
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
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
23 changes: 23 additions & 0 deletions
23
ByeBoo-iOS/ByeBoo-iOS/Domain/UseCase/DeleteCommonQuestUseCase.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,23 @@ | ||
| // | ||
| // DeleteCommonQuestUseCase.swift | ||
| // ByeBoo-iOS | ||
| // | ||
| // Created by APPLE on 3/10/26. | ||
| // | ||
|
|
||
| protocol DeleteCommonQuestUseCase { | ||
| func execute(answerID: Int) async throws | ||
| } | ||
|
|
||
| struct DefaultDeleteCommonQuestUseCase: DeleteCommonQuestUseCase { | ||
|
|
||
| private let repository: CommonQuestInterface | ||
|
|
||
| init(repository: CommonQuestInterface) { | ||
| self.repository = repository | ||
| } | ||
|
|
||
| func execute(answerID: Int) async throws { | ||
| try await repository.deleteCommonQuest(answerID: answerID) | ||
| } | ||
| } |
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
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 |
|---|---|---|
|
|
@@ -12,36 +12,43 @@ final class CommonQuestBottomSheetViewModel { | |
|
|
||
| private var reportQuestSubject: PassthroughSubject<Result<Void, ByeBooError>, Never> = .init() | ||
| private var blockUserSubject: PassthroughSubject<Result<Void, ByeBooError>, Never> = .init() | ||
| private var deleteQuestSubject: PassthroughSubject<Result<Void, ByeBooError>, Never> = .init() | ||
|
|
||
| var output: Output { | ||
| Output( | ||
| reportQuestPublisher: reportQuestSubject.eraseToAnyPublisher(), | ||
| blockUserPublisher: blockUserSubject.eraseToAnyPublisher() | ||
| blockUserPublisher: blockUserSubject.eraseToAnyPublisher(), | ||
| deleteQuestPublisher: deleteQuestSubject.eraseToAnyPublisher() | ||
| ) | ||
| } | ||
|
|
||
| private let blockUserUseCase: BlockUserUseCase | ||
| private let reportCommonQuestUseCase: ReportsCommonQuestAnswerUseCase | ||
| private let deleteCommonQuestUseCase: DeleteCommonQuestUseCase | ||
| private var cancellables = Set<AnyCancellable>() | ||
|
|
||
| init( | ||
| blockUserUseCase: BlockUserUseCase, | ||
| reportCommonQuestUseCase: ReportsCommonQuestAnswerUseCase | ||
| reportCommonQuestUseCase: ReportsCommonQuestAnswerUseCase, | ||
| deleteCommonQuestUseCase: DeleteCommonQuestUseCase | ||
| ) { | ||
| self.blockUserUseCase = blockUserUseCase | ||
| self.reportCommonQuestUseCase = reportCommonQuestUseCase | ||
| self.deleteCommonQuestUseCase = deleteCommonQuestUseCase | ||
| } | ||
| } | ||
|
|
||
| extension CommonQuestBottomSheetViewModel: ViewModelType { | ||
| enum Input { | ||
| case block(userID: Int) | ||
| case report(answerID: Int) | ||
| case delete(answerID: Int) | ||
| } | ||
|
|
||
| struct Output { | ||
| let reportQuestPublisher: AnyPublisher<Result<Void, ByeBooError>, Never> | ||
| let blockUserPublisher: AnyPublisher<Result<Void, ByeBooError>, Never> | ||
| let deleteQuestPublisher: AnyPublisher<Result<Void, ByeBooError>, Never> | ||
| } | ||
|
|
||
| func action(_ trigger: Input) { | ||
|
|
@@ -50,6 +57,8 @@ extension CommonQuestBottomSheetViewModel: ViewModelType { | |
| blockUser(userID: userID) | ||
| case .report(let answerID): | ||
| reportCommonQuest(answerID: answerID) | ||
| case .delete(let answerID): | ||
| deleteCommonQuest(answerID: answerID) | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -61,11 +70,7 @@ extension CommonQuestBottomSheetViewModel { | |
| try await blockUserUseCase.execute(userID: userID) | ||
| blockUserSubject.send(.success(())) | ||
| } catch { | ||
| guard let error = error as? ByeBooError else { | ||
| return | ||
| } | ||
| ByeBooLogger.error(error as ByeBooError) | ||
| blockUserSubject.send(.failure(error)) | ||
| sendError(error: error) | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -76,12 +81,27 @@ extension CommonQuestBottomSheetViewModel { | |
| try await reportCommonQuestUseCase.execute(answerID: answerID) | ||
| reportQuestSubject.send(.success(())) | ||
| } catch { | ||
| guard let error = error as? ByeBooError else { | ||
| return | ||
| } | ||
| ByeBooLogger.error(error as ByeBooError) | ||
| reportQuestSubject.send(.failure(error)) | ||
| sendError(error: error) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private func deleteCommonQuest(answerID: Int) { | ||
| Task { | ||
| do { | ||
| try await deleteCommonQuestUseCase.execute(answerID: answerID) | ||
| deleteQuestSubject.send(.success(())) | ||
| } catch { | ||
| sendError(error: error) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private func sendError(error: Error) { | ||
| guard let error = error as? ByeBooError else { | ||
| return | ||
| } | ||
| ByeBooLogger.error(error as ByeBooError) | ||
| reportQuestSubject.send(.failure(error)) | ||
|
Comment on lines
+100
to
+105
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오호 |
||
| } | ||
| } | ||
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
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
Oops, something went wrong.
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.
나중에 이런 literal 값들 따로 관리할 수 있도록 하면 좋을 것 같은데 어떻게 생각하세용 ?
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.
아 좋아요좋아요 Literal 폴더 하나 만드시죠