Centralize App Entry Flow Based on AppEntryState#110
Merged
Conversation
- `UserDataStore`에 전체 사용자 데이터를 한 번에 갱신하는 `setUserData(UserData)` 함수를 추가했습니다. - `UserData`를 `UserDataProto`로 변환하는 `toProto()` 확장 함수를 `UserDataMapper.kt`에 추가했습니다.
- `UserDataResponse`의 `kakaoId` 타입을 `String?`에서 `Long?`으로 변경했습니다. - `UserDataResponse.toModel()`에서 `kakaoId`를 `toString()`으로 변환하여 `UserData` 모델에 매핑했습니다. - API 응답과 모델 간 `kakaoId` 타입 불일치로 발생하던 매핑 오류를 해결했습니다. - `kakaoId`와 `email` 관련 API 수정 필요성에 대한 TODO 주석을 추가했습니다.
- `UserDataRepository` 인터페이스에 `syncUserData(): Flow<Unit>` 함수를 추가했습니다. - `DefaultUserDataRepository`에 `syncUserData` 함수를 구현하여, `UserRemoteDataSource`를 통해 사용자 데이터를 가져오고 `UserDataStore`에 저장하도록 했습니다. - `OfflineFirstUserDataRepository`의 이름을 `DefaultUserDataRepository`로 변경했습니다.
- `MainActivityViewModel`을 추가하여 앱 진입 시 인증 상태 및 사용자 데이터 동기화 상태를 관리합니다. - `AppEntryState`(Idle, Syncing, Authenticated, Unauthenticated, Error)를 정의하여 UI에서 다양한 상태를 처리할 수 있도록 했습니다. - `AuthRepository`의 `isSignedIn` 상태에 따라 사용자 데이터 동기화를 시도하고, 그 결과를 `AppEntryState`로 변환해 `StateFlow`로 제공합니다.
- `DefaultAuthRepository`와 `DefaultUserDataRepository`의 접근 제어자를 `internal`로 변경했습니다. - 외부 모듈에서의 직접 접근을 방지하여 캡슐화를 강화했습니다.
- `SplashViewModel` 및 `SplashUiState` 삭제, 스플래시 진입 시 인증 상태를 직접 조회하지 않음. - `SplashScreen`에서 `onAuthenticated`, `onAuthenticationRequired` 콜백 제거. - 스플래시 화면은 UI 전용 컴포저블로 축소, 진입 분기 로직은 제거. - `splashScreen()` 네비게이션 빌더도 콜백 없는 형태로 변경. - 초기 화면 전환은 `AikuApp`의 전역 상태 기반으로 처리하도록 구조 변경.
- `SignInScreen`에서 `onSignInSuccess` 콜백 삭제, 로그인 성공 시 전역 `AppEntryState` 변화를 통해 화면 전환 처리. - UI에서는 회원가입이 필요한 경우에만 `onSignUpRequired(socialType, idToken, email)` 호출. - `authSection()` 네비게이션 빌더에서 `onSignInSuccess` 인자 제거.
…signin flow - `MainActivity`에서 `MainActivityViewModel`을 통해 앱 진입 상태(`appEntryState`)를 관리하도록 변경. - `AikuApp`은 `appEntryState`를 기반으로 초기 화면을 결정하며, 인증 상태에 따라 `HomeScreen` 또는 `SignInScreen`으로 자동 전환. - `SplashScreen`에서 인증 분기 및 네비게이션 콜백(`onAuthenticated`, `onAuthenticationRequired`) 제거, UI 전용 컴포저블로 단순화. - `authSection()`에서 `onSignInSuccess` 콜백 제거, 회원가입 필요 시 `onSignUpRequired`만 처리하도록 변경. - 인증/스플래시 분기 로직을 `AikuApp` 전역 상태 기반으로 이관하여 진입 흐름 일원화.
- 로그인 성공 시 별도의 `Success` 상태를 거치지 않고 바로 `Idle` 상태로 복귀하도록 구조 변경 - 불필요해진 `SignInUiState.Success` 정의 제거 - `_uiState.value =` 대신 `MutableStateFlow.update`를 사용하여 상태 변경 가독성 및 안전성 개선
…uth state - `SignUpStep.Success` 상태 및 해당 처리 로직 삭제 - `AuthNavigation`에서 `onSignUpCompleted` 콜백 제거 및 `SignUpScreen` 호출 시 해당 콜백 전달 로직 삭제 - 회원가입 완료 후 전역 인증 상태(`isSignedIn`) 기반으로 홈 화면 등 다음 화면으로 자동 전환되도록 구조 변경
3 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PULL REQUEST
Description
사용자 데이터 관리 개선
UserDataStore에 전체 사용자 데이터를 한 번에 갱신하는setUserData(UserData)메서드 추가.UserData→UserDataProto변환용toProto()확장 함수 추가.UserDataResponse의kakaoId타입을String?→Long?으로 변경.kakaoId를toString()변환하여UserData모델에 적용.(TODO: API 스펙 수정 요청 필요)
UserDataRepository에syncUserData(): Flow<Unit>API 추가.DefaultUserDataRepository에서 원격 조회 후 로컬(UserDataStore) 저장 로직 구현.OfflineFirstUserDataRepository를DefaultUserDataRepository로 네이밍 변경.DefaultAuthRepository,DefaultUserDataRepository를internal로 변경해 외부 접근 차단.앱 진입 상태(AppEntryState) 기반 흐름 중앙화
MainActivityViewModel에서 앱 진입 상태를AppEntryState(Idle, Syncing, Authenticated, Unauthenticated, Error)로 관리.isSignedIn여부 확인 → 로그인 상태면syncUserData()실행 후 상태 전환.AikuApp이appEntryState를 수집해 초기 화면을 자동 결정(Splash → Home/SignIn).Splash/Auth 구조 및 네비게이션 간소화
SplashViewModel및SplashUiState삭제 → UI 전용 컴포저블로 단순화.SplashScreen과splashScreen()네비게이션 빌더에서 콜백 제거.onSignInSuccess콜백 제거, 로그인 성공 시 전역AppEntryState변화로 화면 전환.SignInUiState에서Success상태 제거 → 성공 시Idle로 즉시 전환._uiState.update사용으로 가독성과 안정성 향상.SignUpStep.Success상태 및 후속 네비게이션 로직 삭제.onSignUpCompleted콜백 제거 → 회원가입 완료 시 전역 인증 상태 기반 자동 전환.