diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/signup/SignUpViewModel.kt b/app/src/main/java/com/teumteum/teumteum/presentation/signup/SignUpViewModel.kt index 43625b0c..b6890ef2 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/signup/SignUpViewModel.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/signup/SignUpViewModel.kt @@ -19,6 +19,7 @@ import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.launch +import timber.log.Timber import javax.inject.Inject @HiltViewModel @@ -205,12 +206,14 @@ class SignUpViewModel @Inject constructor( } fun setAllInterests(interests: List, selfResource: Array, fieldResource: Array) { + Timber.tag("teum-fix").d("setAllInterests called") interestSelf.value.clear() interestField.value.clear() for (i in interests) { if (i in selfResource) addInterestSelf(i) else if (i in fieldResource) addInterestField(i) } + updateInterestCount() } private var _goalText = MutableStateFlow("") diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/signup/fix/CardFixFragment.kt b/app/src/main/java/com/teumteum/teumteum/presentation/signup/fix/CardFixFragment.kt index aded80ff..404b615a 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/signup/fix/CardFixFragment.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/signup/fix/CardFixFragment.kt @@ -28,6 +28,7 @@ import com.teumteum.teumteum.util.custom.view.model.BackCard import com.teumteum.teumteum.util.custom.view.model.FrontCard import com.teumteum.teumteum.util.custom.view.model.Interest import dagger.hilt.android.AndroidEntryPoint +import timber.log.Timber import java.util.Locale @AndroidEntryPoint @@ -39,6 +40,7 @@ class CardFixFragment private lateinit var frontAnimation: AnimatorSet private lateinit var backAnimation: AnimatorSet private var isFront = true + private var isFirstLoaded = true override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -50,6 +52,7 @@ class CardFixFragment private fun initCard() { with(viewModel) { + Timber.tag("teum-fix").d("initCard called") val fc = CHARACTER_CARD_LIST[characterId.value]?.let { when (community.value) { STATUS_WORKER -> FrontCard(userName.value, "@${companyName.value}", jobDetailClass.value, @@ -190,9 +193,12 @@ class CardFixFragment } } currentList.observe(viewLifecycleOwner) { interests -> - val selfArray = resources.getStringArray(R.array.interest_1) - val fieldArray = resources.getStringArray(R.array.interest_2) - viewModel.setAllInterests(interests.map { it.toString() }, selfArray, fieldArray) + if (!isFirstLoaded) { + val selfArray = resources.getStringArray(R.array.interest_1) + val fieldArray = resources.getStringArray(R.array.interest_2) + viewModel.setAllInterests(interests.map { it.toString() }, selfArray, fieldArray) + } + isFirstLoaded = false } } }