-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT/#292] 구글 로그인 구현합니다. #310
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 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4b8e4b3
[ADD/#292] 구글 로그인 관련 라이브러리 추가
MoonsuKang 87d03d7
[REFACTOR/#292] 스플래시 화면 자동 로그인 로직 및 버전 확인 탐색 개선
MoonsuKang e8c32c6
[ADD/#292] OAuth 정보 저장 및 관리 기능 추가
MoonsuKang 196334a
[FEAT/#292] 구글 회원가입 API 연동
MoonsuKang 0fdb143
[FEAT/#292] Google 회원가입 기능 추가
MoonsuKang 3932c57
[ADD/#292] 로그인 타입 분기
MoonsuKang 89ce95c
[FEAT/#292] 구글 로그인 기능 구현
MoonsuKang fcca072
[FEAT/#292] 회원가입 API 연동 및 구글 회원가입 로직 추가
MoonsuKang c7fdbb0
[REFACTOR/#292] 로그인 API 요청 시 불필요한 값 제거
MoonsuKang ff0653b
[REFACTOR/#292] 로그인 타입 로직 LanguageProvider로 이동
MoonsuKang ba767df
[FEAT/#292] 로그인 플랫폼 별 아이콘 분기 처리
MoonsuKang 8f766ef
[REFACTOR/#292] SplashState에서 불필요한 isUserLoggedIn 제거
MoonsuKang 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,6 @@ import com.airbnb.mvrx.MavericksViewModel | |
| import com.airbnb.mvrx.MavericksViewModelFactory | ||
| import com.airbnb.mvrx.hilt.AssistedViewModelFactory | ||
| import com.airbnb.mvrx.hilt.hiltMavericksViewModelFactory | ||
| import com.airbnb.mvrx.withState | ||
| import com.sopt.clody.BuildConfig | ||
| import com.sopt.clody.domain.appupdate.AppUpdateChecker | ||
| import com.sopt.clody.domain.model.AppUpdateState | ||
|
|
@@ -58,8 +57,9 @@ class SplashViewModel @AssistedInject constructor( | |
| AmplitudeUtils.trackEvent(AmplitudeConstraints.ALARM) | ||
| } | ||
| if (!BuildConfig.DEBUG && checkInspectionAndHandle()) return | ||
| checkVersionAndNavigate() | ||
| attemptAutoLogin() | ||
|
|
||
| val isLoggedIn = attemptAutoLogin() | ||
| checkVersionAndNavigate(isLoggedIn) | ||
| } | ||
|
|
||
| private suspend fun checkInspectionAndHandle(): Boolean { | ||
|
|
@@ -76,21 +76,20 @@ class SplashViewModel @AssistedInject constructor( | |
| return false | ||
| } | ||
|
|
||
| private fun attemptAutoLogin() { | ||
| private fun attemptAutoLogin(): Boolean { | ||
| val isLoggedIn = tokenRepository.getAccessToken().isNotBlank() && | ||
| tokenRepository.getRefreshToken().isNotBlank() | ||
| setState { copy(isUserLoggedIn = isLoggedIn) } | ||
|
||
| return isLoggedIn | ||
| } | ||
|
|
||
| private suspend fun checkVersionAndNavigate() { | ||
| private suspend fun checkVersionAndNavigate(isLoggedIn: Boolean) { | ||
| val updateState = appUpdateChecker.getAppUpdateState(BuildConfig.VERSION_NAME) | ||
| setState { copy(updateState = updateState) } | ||
|
|
||
| if (updateState == AppUpdateState.Latest) { | ||
| delay(1000) | ||
| val isLoggedIn = withState(this@SplashViewModel) { it.isUserLoggedIn } | ||
|
|
||
| if (isLoggedIn == true) { | ||
| if (isLoggedIn) { | ||
| _sideEffects.send(SplashContract.SplashSideEffect.NavigateToHome) | ||
| } else { | ||
| _sideEffects.send(SplashContract.SplashSideEffect.NavigateToLogin) | ||
|
|
||
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.
[p5]
이제 스플래시 뷰모델 로직은
디버그/릴리즈 버전 체크 && 점검시간 체크 -> 토큰 유뮤로 자동 로그인 체크 -> 앱 버전 업데이트 체크 -> 최신 버전이고 자동 로그인 가능하면 홈 아니면 로그인 화면으로 이동이겠네요!