Skip to content

Commit d16a2d7

Browse files
committed
develop fix: splash 화면 accessToken 검증 절차 수정
1 parent aabf8dd commit d16a2d7

4 files changed

Lines changed: 15 additions & 25 deletions

File tree

data/src/main/java/com/moneymong/moneymong/data/repository/user/UserRepositoryImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import javax.inject.Inject
1010

1111
class UserRepositoryImpl @Inject constructor(
1212
private val userRemoteDataSource: UserRemoteDataSource,
13+
private val userLocalDataSource: UserLocalDataSource,
1314
private val loginLocalDataSource: LoginLocalDataSource
14-
private val userLocalDataSource: UserLocalDataSource
1515
) : UserRepository {
1616

1717
override suspend fun getMyInfo(): Result<UserEntity> {

feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SplashScreen.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@ fun SplashScreen(
3333
val state = viewModel.collectAsState().value
3434

3535
LaunchedEffect(key1 = state.isTokenValid) {
36-
state.isTokenValid?.let { isValid ->
37-
if (isValid) {
38-
navigateToLedger()
39-
} else {
40-
navigateToLogin()
41-
}
36+
if (state.isTokenValid) {
37+
navigateToLedger()
38+
} else {
39+
navigateToLogin()
4240
}
4341
}
4442

feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SplashState.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import com.moneymong.moneymong.common.base.State
44

55
data class SplashState(
66
val startAnimation: Boolean = false,
7-
val isTokenValid: Boolean? = null
7+
val isTokenValid: Boolean = false
88
) : State

feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SplashViewModel.kt

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import com.moneymong.moneymong.domain.usecase.login.TokenUseCase
55
import com.moneymong.moneymong.feature.sign.sideeffect.SplashSideEffect
66
import com.moneymong.moneymong.feature.sign.state.SplashState
77
import dagger.hilt.android.lifecycle.HiltViewModel
8-
import kotlinx.coroutines.CoroutineScope
9-
import kotlinx.coroutines.Dispatchers
10-
import kotlinx.coroutines.launch
118
import org.orbitmvi.orbit.syntax.simple.intent
129
import org.orbitmvi.orbit.syntax.simple.reduce
1310
import javax.inject.Inject
@@ -30,23 +27,18 @@ class SplashViewModel @Inject constructor(
3027
fun checkTokenValidity() = intent {
3128
tokenUseCase.getAccessToken()
3229
.onSuccess {
33-
if (it.isNotEmpty()) {
34-
reduce {
35-
state.copy(
36-
isTokenValid = true
37-
)
38-
}
39-
} else {
40-
reduce {
41-
state.copy(
42-
isTokenValid = false
43-
)
44-
}
30+
reduce {
31+
state.copy(
32+
isTokenValid = true
33+
)
4534
}
4635
}
4736
.onFailure {
48-
//TODO - 에러 화면
37+
reduce {
38+
state.copy(
39+
isTokenValid = false
40+
)
41+
}
4942
}
5043
}
51-
5244
}

0 commit comments

Comments
 (0)