diff --git a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt index 0acd817a..f04dc7ba 100644 --- a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt +++ b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/SignUpScreen.kt @@ -62,11 +62,6 @@ fun SignUpRoute( val context = LocalContext.current val uiState: SignUpState by viewModel.uiState.collectAsStateWithLifecycle() val termState: TermState by termViewModel.uiState.collectAsStateWithLifecycle() - val localTerms = remember { - persistentListOf( - Term(id = 0, title = context.getString(R.string.signup_term_over_14), isEssential = true, canRead = false), - ) - } BackHandler { viewModel.goPreviousStep() @@ -86,7 +81,7 @@ fun SignUpRoute( } LaunchedEffect(key1 = Unit) { - termViewModel.getTermList(localTerms = localTerms) + termViewModel.getTermList() } Box( diff --git a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/TermViewModel.kt b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/TermViewModel.kt index 4c5537b4..4a79450e 100644 --- a/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/TermViewModel.kt +++ b/feature/loginsignup/src/main/java/com/susu/feature/loginsignup/signup/TermViewModel.kt @@ -7,6 +7,7 @@ import com.susu.domain.usecase.loginsignup.GetTermDetailUseCase import com.susu.domain.usecase.loginsignup.GetTermsUseCase import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.collections.immutable.PersistentList +import kotlinx.collections.immutable.toPersistentList import kotlinx.coroutines.launch import javax.inject.Inject @@ -16,11 +17,11 @@ class TermViewModel @Inject constructor( private val getTermDetailUseCase: GetTermDetailUseCase, ) : BaseViewModel(TermState()) { - fun getTermList(localTerms: PersistentList) { + fun getTermList() { viewModelScope.launch { intent { copy(isLoading = true) } getTermsUseCase().onSuccess { - intent { copy(terms = localTerms.addAll(it), isLoading = false) } + intent { copy(terms = it.toPersistentList(), isLoading = false) } }.onFailure { postSideEffect(TermEffect.ShowToast(it.message ?: "약관을 불러오지 못했어요")) }