Skip to content

Conversation

@y-eonee
Copy link
Collaborator

@y-eonee y-eonee commented Dec 5, 2025

🔗 연결된 이슈

📄 작업 내용

  • 마이페이지 완료한 퀘스트 다시보기 화면에서 개별 퀘스트 다시보기 화면으로 넘어간 후, X 버튼을 누르면 퀘스트 메인으로 이동함 → 기존대로 변경 필요(X버튼 누르면 완료한 퀘스트 전체 다시보기 화면으로)
  • 행동형 퀘스트 수정 시, 생각 적기(텍스트)만 적어도 수정이 가능하도록 해야함
구현 내용 작성 수정
GIF

💻 주요 코드 설명

아카이브 뷰컨트롤러 진입점 구분

enum ArchiveViewControllerEntryPoint {
    case mypage
    case questMain
    case edit
}

수정하기 기능을 추가하면서 수정 완료 후 푸시된 아카이브에서 close를 하면 pop할 때 다시 수정뷰컨트롤러로 돌아가는 문제가 있었습니다. 그래서 아예 루트를 퀘스트메인으로 바꾸는 코드를 썼었는데 이게 이번 QA에서 마이페이지에서 진입 시 퀘스트메인으로 가는 오류가 잡혔더라구요. 그래서 진입점을 구분해서 분기처리를 해줬습니다.

func close() {
        guard let entryViewController else { return }
        switch entryViewController {
        case .mypage, .questMain:
            self.navigationController?.popViewController(animated: true)
        case .edit:
            let viewController = ByeBooTabBar()
            viewController.selectedIndex = 1
            
            if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
               let window = windowScene.windows.first(where: { $0.isKeyWindow }) {
                
                ViewControllerUtils.setRootViewController(
                    window: window,
                    viewController: viewController,
                    withAnimation: true
                )
            }
        }
    }

행동형 퀘스트 수정

  • 질문형처럼 뷰모델로 유효성검증 로직을 분리했습니다
func executeWhenActiceType(previousText: String, changingText: String, imgCount: Int) -> Bool {
        if !previousText.isEmpty {
            let isValidAnswer: Bool = previousText != changingText && imgCount == 1
            return isValidAnswer
        } else {
            if imgCount == 1 { return true }
            return false // 빈 텍스트만 입력하는 경우를 분기처리합니다 
        }
    }

@y-eonee y-eonee self-assigned this Dec 5, 2025
@y-eonee y-eonee added 나연🐹 refactor 기존 코드 리팩토링 labels Dec 5, 2025
Copy link
Collaborator

@dev-domo dev-domo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

깔꼼합니다

protocol IsValidQuestAnswerUseCase {
func execute(previousText: String, changingText: String) -> Bool
func executeWhenQuestionType(previousText: String, changingText: String) -> Bool
func executeWhenActiceType(previousText: String, changingText: String, imgCount: Int) -> Bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

파라미터가 서로 다르니까 두 메서드 다 execute로 해도 나쁘지 않을듯? 개인 취향인 것 같습니당

import Combine
import UIKit

enum ArchiveViewControllerEntryPoint {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋습니다~

changingText: changingText,
imgCount: imgCount
)
isValidTextSubject.send(isValidText)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 반영 감사합니당

@y-eonee y-eonee merged commit e60b154 into develop Dec 5, 2025
1 check passed
@y-eonee y-eonee deleted the refactor/#341-3차-qa branch December 5, 2025 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor 기존 코드 리팩토링 나연🐹

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants