Skip to content

Commit 712e1b5

Browse files
committed
[CHORE]#205 : versionName UiState -> ViewModel Variable로 변경
1 parent 08b84da commit 712e1b5

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

feature/auth/src/main/kotlin/com/bff/wespot/auth/state/AuthUiState.kt

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import kotlinx.coroutines.flow.flow
77
import java.util.UUID
88

99
data class AuthUiState(
10-
val versionName: String = "",
1110
val schoolName: String = "",
1211
val schoolList: Flow<PagingData<School>> = flow { },
1312
val selectedSchool: School? = null,

feature/auth/src/main/kotlin/com/bff/wespot/auth/viewmodel/AuthViewModel.kt

+7-8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class AuthViewModel @Inject constructor(
6262
remoteConfigRepository.fetchFromRemoteConfig(RemoteConfigKey.MARKETING_SERVICE_TERM),
6363
),
6464
)
65+
private var appVersionName: String = ""
6566

6667
private val loginStateP: MutableLiveData<LoginState> = MutableLiveData()
6768
val loginState: LiveData<LoginState> = loginStateP
@@ -94,10 +95,8 @@ class AuthViewModel @Inject constructor(
9495
}
9596
}
9697

97-
private fun handleOnActivityCreated(versionName: String) = intent {
98-
reduce {
99-
state.copy(versionName = versionName)
100-
}
98+
private fun handleOnActivityCreated(versionName: String) {
99+
appVersionName = versionName
101100
}
102101

103102
private fun loginWithKakao(kakaoAuthToken: KakaoAuthToken) = intent {
@@ -107,7 +106,7 @@ class AuthViewModel @Inject constructor(
107106
SignIn(
108107
accessToken = kakaoAuthToken.accessToken,
109108
socialType = kakaoAuthToken.socialType,
110-
versionName = state.versionName,
109+
versionName = appVersionName,
111110
),
112111
).onSuccess {
113112
if (it == LoginState.LOGIN_SUCCESS) {
@@ -126,9 +125,9 @@ class AuthViewModel @Inject constructor(
126125
}
127126
}
128127

129-
private fun autoLogin() = intent {
128+
private fun autoLogin() {
130129
viewModelScope.launch {
131-
autoLoginUseCase(state.versionName).let {
130+
autoLoginUseCase(appVersionName).let {
132131
loginStateP.postValue(it)
133132
}
134133
}
@@ -153,7 +152,7 @@ class AuthViewModel @Inject constructor(
153152
),
154153
profileUrl = state.imageUrl,
155154
introduction = state.introduction,
156-
versionName = state.versionName,
155+
versionName = appVersionName,
157156
),
158157
)
159158

0 commit comments

Comments
 (0)