Skip to content

[#539] LoginView에 TCA를 적용한다#541

Merged
opficdev merged 13 commits into
developfrom
refactor/#539-loginview
Jun 5, 2026
Merged

[#539] LoginView에 TCA를 적용한다#541
opficdev merged 13 commits into
developfrom
refactor/#539-loginview

Conversation

@opficdev
Copy link
Copy Markdown
Owner

@opficdev opficdev commented Jun 5, 2026

🔗 연관된 이슈

🎯 의도

  • LoginView의 상태 관리 흐름을 TCA 기반 LoginFeature로 전환
  • Swift concurrency 환경에서 로그인 관련 의존성 체인의 Sendable 경고를 정리하기 위함

📝 작업 내용

📌 요약

  • 기존 LoginViewModel 기반 로그인 흐름을 LoginFeature 기반으로 변경
  • 기존 Presentation Store 프로토콜명을 StorePattern으로 변경해 TCA Store와 이름 충돌 방지
  • LoginFeatureTests를 기존 테스트 시나리오와 호환되는 형태로 구성
  • SignInUseCase 체인과 로그인/인증 서비스 프로토콜에 Sendable 적용
  • Firebase, UserDefaults 등 외부 비-Sendable 타입은 모듈 내부 래퍼로 감싸서 처리
  • DevLog agent/harness 문서의 검증 규칙과 작업 지침 정리

🔍 상세

  • LoginView가 직접 ViewModel을 소유하지 않고 StoreOf<LoginFeature>를 주입받도록 변경
  • RootViewDevLogApp에서 로그인 Store 생성 및 의존성 주입을 담당하도록 구성
  • 기존 LoginViewModelTestsLoginFeatureTests로 전환하고, 테스트 드라이버는 feature 중심으로 정리
  • AuthService, AuthenticationService, UserService, WidgetSnapshotPreferenceStore, WidgetSnapshotUpdater, AuthenticationRepositorySendable 계약 추가
  • Firebase SDK 타입은 FirebaseDependency로 감싸고 필요한 공개 API만 노출
  • UserDefaults는 앱 Persistence와 WidgetCore 각각의 사용 범위에 맞춘 UserDefaultsDependency로 감싸서 처리
  • AuthServiceImpl의 auth state 관찰은 현재 Combine 기반 CurrentValueSubject를 유지하되, Sendable 처리를 위해 내부 publisher 객체로 분리

검토 요청:

  • AuthServiceImpl의 인증 상태 관찰은 현재 Combine 기반으로 유지되어 있음
  • Combine 타입은 Swift concurrency의 Sendable 모델과 잘 맞지 않아 @unchecked Sendable, lock, 내부 래퍼가 필요해지는 구조임
  • 이 흐름은 AsyncStream<Bool> 기반으로 전환하면 concurrency 모델과 더 자연스럽게 맞을 수 있어 보임
  • 다만 기존 observeSignedIn() -> AnyPublisher<Bool, Never> 계약 변경이 필요하므로, 이번 PR에서는 유지하고 후속 작업으로 AsyncStream 전환 여부 검토 요청

📸 영상 / 이미지 (Optional)

@opficdev opficdev self-assigned this Jun 5, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request renames the custom Store protocol to StorePattern across the codebase to prevent naming conflicts, migrates the login flow from the custom MVI pattern to Composable Architecture (TCA) with the introduction of LoginFeature, and enhances concurrency safety by adopting Sendable conformances and introducing thread-safe wrappers like FirebaseDependency and UserDefaultsDependency. The review feedback recommends using NSRecursiveLock instead of NSLock in AuthStatePublisher to avoid potential deadlocks from synchronous subscriber re-entrancy, and suggests declaring loginStore as a constant (let) rather than @State in RootView to follow TCA best practices.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread Application/DevLogInfra/Sources/Service/AuthServiceImpl.swift
Comment thread Application/DevLogPresentation/Sources/Root/RootView.swift Outdated
Comment thread Application/DevLogPresentation/Sources/Root/RootView.swift Outdated
@opficdev opficdev merged commit 222dade into develop Jun 5, 2026
5 checks passed
@opficdev opficdev deleted the refactor/#539-loginview branch June 5, 2026 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LoginView에 TCA를 적용한다

1 participant