From 38df1206deaaba59c283bbd8c03a6433f7e5481a Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Tue, 14 Nov 2023 05:00:48 +0900 Subject: [PATCH] [FEAT] SignUp Process ExposureLogging Complete (#156) --- .../android/auth/ui/signup/SignUpViewModel.kt | 16 ++++++---- .../ui/signup/common/ChooseRoleFragment.kt | 2 +- .../ui/signup/common/IntroductionFragment.kt | 2 +- .../auth/ui/signup/common/TechTagFragment.kt | 11 +++++++ .../reviewee/EducationStatusFragment.kt | 2 +- .../ui/signup/reviewee/RealNameFragment.kt | 3 +- .../ui/signup/reviewer/BankAccountFragment.kt | 31 ++++++++++++++----- .../signup/reviewer/CareerPeriodFragment.kt | 11 +++++++ .../ui/signup/reviewer/CompanyNameFragment.kt | 11 +++++++ .../ui/signup/reviewer/PositionFragment.kt | 11 +++++++ 10 files changed, 83 insertions(+), 17 deletions(-) diff --git a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/SignUpViewModel.kt b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/SignUpViewModel.kt index 580334b4..b4e987d4 100644 --- a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/SignUpViewModel.kt +++ b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/SignUpViewModel.kt @@ -23,8 +23,6 @@ import com.lgtm.domain.entity.request.SignUpSeniorRequestVO import com.lgtm.domain.entity.response.MemberDataDTO import com.lgtm.domain.entity.response.SignUpResponseVO import com.lgtm.domain.repository.AuthRepository -import com.swm.logging.android.SWMLogging -import com.swm.logging.android.logging_scheme.SWMLoggingScheme import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.launch import javax.inject.Inject @@ -314,14 +312,14 @@ class SignUpViewModel @Inject constructor( } private val _accountNumber = MutableLiveData() - private val accountNumber: LiveData = _accountNumber + val accountNumber: LiveData = _accountNumber fun setAccountNumber(number: String) { _accountNumber.value = number } private val _accountHolder = MutableLiveData() - private val accountHolder: LiveData = _accountHolder + val accountHolder: LiveData = _accountHolder fun setAccountHolder(holder: String) { _accountHolder.value = holder @@ -423,8 +421,14 @@ class SignUpViewModel @Inject constructor( } } - fun shotSignUpExposureLogging(scheme : SWMLoggingScheme) { - SWMLogging.logEvent(scheme) + fun clearSignUpState() { + _signUpState.value = NetworkState.Init + } + + private val _selectedBankIdx = MutableLiveData() + val selectedBankIdx: LiveData = _selectedBankIdx + fun setSelectedBankIdx(position: Int) { + _selectedBankIdx.value = position } companion object { diff --git a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/common/ChooseRoleFragment.kt b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/common/ChooseRoleFragment.kt index 0c4ba3bc..ec3be9ea 100644 --- a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/common/ChooseRoleFragment.kt +++ b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/common/ChooseRoleFragment.kt @@ -59,7 +59,7 @@ class ChooseRoleFragment : BaseFragment(R.layout.frag val scheme = SwmCommonLoggingScheme.Builder() .setEventLogName("chooseRoleExposure") .setScreenName(this.javaClass) - .setLogData(mapOf("signUpStep" to 4)) + .setLogData(mapOf("signUpStep" to 5)) .build() viewModel.shotSwmLogging(scheme) } diff --git a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/common/IntroductionFragment.kt b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/common/IntroductionFragment.kt index 262c0c35..ab9a5c89 100644 --- a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/common/IntroductionFragment.kt +++ b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/common/IntroductionFragment.kt @@ -62,7 +62,7 @@ class IntroductionFragment : val scheme = SwmCommonLoggingScheme.Builder() .setEventLogName("introductionExposure") .setScreenName(this.javaClass) - .setLogData(mapOf("signUpStep" to 3)) + .setLogData(mapOf("signUpStep" to 4)) .build() viewModel.shotSwmLogging(scheme) } diff --git a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/common/TechTagFragment.kt b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/common/TechTagFragment.kt index 7924ada3..70f16bc2 100644 --- a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/common/TechTagFragment.kt +++ b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/common/TechTagFragment.kt @@ -11,6 +11,7 @@ import com.lgtm.android.common_ui.base.BaseFragment import com.lgtm.android.common_ui.util.TechTagChipGroup import com.lgtm.android.common_ui.util.TechTagTheme import com.lgtm.android.common_ui.util.setOnThrottleClickListener +import com.lgtm.domain.logging.SwmCommonLoggingScheme import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint @@ -25,6 +26,7 @@ class TechTagFragment : BaseFragment(R.layout.fragment_t setChips() observeTechTagList() setupNextButtonListener() + shotTechTagExposureLogging() } private fun setupViewModel() { @@ -53,4 +55,13 @@ class TechTagFragment : BaseFragment(R.layout.fragment_t private fun navigateToIntroductionFragment() { findNavController().navigate(R.id.action_techTagFragment_to_introductionFragment) } + + private fun shotTechTagExposureLogging() { + val scheme = SwmCommonLoggingScheme.Builder() + .setEventLogName("techTagExposure") + .setScreenName(this.javaClass) + .setLogData(mapOf("signUpStep" to 3)) + .build() + viewModel.shotSwmLogging(scheme) + } } \ No newline at end of file diff --git a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewee/EducationStatusFragment.kt b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewee/EducationStatusFragment.kt index d1d0693a..52b7c85f 100644 --- a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewee/EducationStatusFragment.kt +++ b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewee/EducationStatusFragment.kt @@ -97,7 +97,7 @@ class EducationStatusFragment : val scheme = SwmCommonLoggingScheme.Builder() .setEventLogName("educationStatusExposure") .setScreenName(this.javaClass) - .setLogData(mapOf("signUpStep" to 5, "juniorStep" to 1)) + .setLogData(mapOf("signUpStep" to 6, "juniorStep" to 1)) .build() viewModel.shotSwmLogging(scheme) } diff --git a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewee/RealNameFragment.kt b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewee/RealNameFragment.kt index 02ec71b0..58441a5e 100644 --- a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewee/RealNameFragment.kt +++ b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewee/RealNameFragment.kt @@ -66,6 +66,7 @@ class RealNameFragment : BaseFragment(R.layout.fragment is NetworkState.Failure -> { Toast.makeText(requireContext(), it.msg, Toast.LENGTH_SHORT).show() + signUpViewModel.clearSignUpState() } } } @@ -79,7 +80,7 @@ class RealNameFragment : BaseFragment(R.layout.fragment val scheme = SwmCommonLoggingScheme.Builder() .setEventLogName("realNameExposure") .setScreenName(this.javaClass) - .setLogData(mapOf("signUpStep" to 6, "juniorStep" to 2)) + .setLogData(mapOf("signUpStep" to 7, "juniorStep" to 2)) .build() viewModel.shotSwmLogging(scheme) } diff --git a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/BankAccountFragment.kt b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/BankAccountFragment.kt index d0cd6e9d..bc94cd05 100644 --- a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/BankAccountFragment.kt +++ b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/BankAccountFragment.kt @@ -1,7 +1,8 @@ package com.lgtm.android.auth.ui.signup.reviewer -import android.content.Intent +import android.content.ContentValues.TAG import android.os.Bundle +import android.util.Log import android.view.View import android.widget.AdapterView import android.widget.Toast @@ -9,7 +10,6 @@ import androidx.core.widget.addTextChangedListener import androidx.fragment.app.activityViewModels import com.lgtm.android.auth.R import com.lgtm.android.auth.databinding.FragmentBankAccountBinding -import com.lgtm.android.auth.ui.SignInActivity import com.lgtm.android.auth.ui.signup.SignUpViewModel import com.lgtm.android.common_ui.R.layout import com.lgtm.android.common_ui.adapter.BankSpinnerAdapter @@ -17,10 +17,12 @@ import com.lgtm.android.common_ui.base.BaseFragment import com.lgtm.android.common_ui.constant.Bank import com.lgtm.android.common_ui.util.NetworkState import com.lgtm.android.common_ui.util.setOnThrottleClickListener +import com.lgtm.domain.logging.SwmCommonLoggingScheme class BankAccountFragment : BaseFragment(R.layout.fragment_bank_account) { private val signUpViewModel by activityViewModels() + private lateinit var bankAdapter : BankSpinnerAdapter override fun initializeViewModel() { viewModel = signUpViewModel } @@ -29,16 +31,25 @@ class BankAccountFragment : setupViewModel() onAccountNumberChanged() setupBankSpinner() + setEnteredData() onBankSelectedListener() setupCompleteButtonListener() - observeSignUpStatus() onAccountHolderChanged() + observeSignUpStatus() + shotBankAccountExposureLogging() } private fun setupViewModel() { binding.viewModel = signUpViewModel } + private fun setEnteredData(){ + Log.d(TAG, "setEnteredData: ${signUpViewModel.selectedBankIdx.value}") + binding.spBank.setSelection(signUpViewModel.selectedBankIdx.value ?: 0) + binding.etBankAccount.setText(signUpViewModel.accountNumber.value) + binding.etAccountHolder.setText(signUpViewModel.accountHolder.value) + } + private fun onAccountNumberChanged() { binding.etBankAccount.addTextChangedListener { signUpViewModel.setAccountNumber(it.toString()) @@ -47,8 +58,7 @@ class BankAccountFragment : } private fun setupBankSpinner() { - val bankAdapter = - BankSpinnerAdapter(requireContext(), layout.item_bank_spinner, signUpViewModel.bankList) + bankAdapter = BankSpinnerAdapter(requireContext(), layout.item_bank_spinner, signUpViewModel.bankList) binding.spBank.adapter = bankAdapter } @@ -58,6 +68,7 @@ class BankAccountFragment : parent: AdapterView<*>?, view: View?, position: Int, id: Long ) { if (position == 0) return // Pos 0 Indicate Hint + signUpViewModel.setSelectedBankIdx(position) signUpViewModel.setSelectedBank(signUpViewModel.bankList[position] as Bank) signUpViewModel.setIsAccountInfoValid() } @@ -93,6 +104,7 @@ class BankAccountFragment : is NetworkState.Failure -> { Toast.makeText(requireContext(), it.msg, Toast.LENGTH_SHORT).show() + signUpViewModel.clearSignUpState() } } } @@ -102,8 +114,13 @@ class BankAccountFragment : lgtmNavigator.navigateToMain(requireContext()) } - private fun navigateToSignInActivity() { - startActivity(Intent(requireContext(), SignInActivity::class.java)) + private fun shotBankAccountExposureLogging() { + val scheme = SwmCommonLoggingScheme.Builder() + .setEventLogName("bankAccountExposure") + .setScreenName(this.javaClass) + .setLogData(mapOf("signUpStep" to 9, "seniorStep" to 4)) + .build() + viewModel.shotSwmLogging(scheme) } } \ No newline at end of file diff --git a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/CareerPeriodFragment.kt b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/CareerPeriodFragment.kt index 9d559365..c663c7cb 100644 --- a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/CareerPeriodFragment.kt +++ b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/CareerPeriodFragment.kt @@ -10,6 +10,7 @@ import com.lgtm.android.auth.databinding.FragmentCareerPeriodBinding import com.lgtm.android.auth.ui.signup.SignUpViewModel import com.lgtm.android.common_ui.base.BaseFragment import com.lgtm.android.common_ui.util.setOnThrottleClickListener +import com.lgtm.domain.logging.SwmCommonLoggingScheme class CareerPeriodFragment : @@ -23,6 +24,7 @@ class CareerPeriodFragment : setupViewModel() onCareerPeriodChanged() setupNextButtonListener() + shotCareerPeriodExposureLogging() } @@ -49,4 +51,13 @@ class CareerPeriodFragment : findNavController().navigate(R.id.action_careerPeriodFragment_to_bankAccountFragment) } + private fun shotCareerPeriodExposureLogging() { + val scheme = SwmCommonLoggingScheme.Builder() + .setEventLogName("careerExposure") + .setScreenName(this.javaClass) + .setLogData(mapOf("signUpStep" to 8, "seniorStep" to 3)) + .build() + viewModel.shotSwmLogging(scheme) + } + } \ No newline at end of file diff --git a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/CompanyNameFragment.kt b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/CompanyNameFragment.kt index 3fafb1ad..0c09e39f 100644 --- a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/CompanyNameFragment.kt +++ b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/CompanyNameFragment.kt @@ -9,6 +9,7 @@ import com.lgtm.android.auth.databinding.FragmentCompanyNameBinding import com.lgtm.android.auth.ui.signup.SignUpViewModel import com.lgtm.android.common_ui.base.BaseFragment import com.lgtm.android.common_ui.util.setOnThrottleClickListener +import com.lgtm.domain.logging.SwmCommonLoggingScheme class CompanyNameFragment : BaseFragment(R.layout.fragment_company_name) { @@ -22,6 +23,7 @@ class CompanyNameFragment : setupEditText() onCompanyNameChanged() setupNextButtonListener() + shotCompanyNameExposureLogging() } private fun setupViewModel() { @@ -52,4 +54,13 @@ class CompanyNameFragment : private fun navigateToPositionFragment() { findNavController().navigate(R.id.action_companyNameFragment_to_positionFragment) } + + private fun shotCompanyNameExposureLogging() { + val scheme = SwmCommonLoggingScheme.Builder() + .setEventLogName("companyNameExposure") + .setScreenName(this.javaClass) + .setLogData(mapOf("signUpStep" to 6, "seniorStep" to 1)) + .build() + viewModel.shotSwmLogging(scheme) + } } \ No newline at end of file diff --git a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/PositionFragment.kt b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/PositionFragment.kt index 3a73c113..19a38a0a 100644 --- a/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/PositionFragment.kt +++ b/feature/auth/src/main/java/com/lgtm/android/auth/ui/signup/reviewer/PositionFragment.kt @@ -9,6 +9,7 @@ import com.lgtm.android.auth.databinding.FragmentPositionBinding import com.lgtm.android.auth.ui.signup.SignUpViewModel import com.lgtm.android.common_ui.base.BaseFragment import com.lgtm.android.common_ui.util.setOnThrottleClickListener +import com.lgtm.domain.logging.SwmCommonLoggingScheme class PositionFragment : BaseFragment(R.layout.fragment_position) { @@ -22,6 +23,7 @@ class PositionFragment : setupEditText() onPositionNameChanged() setupNextButtonListener() + shotPositionExposureLogging() } private fun setupViewModel() { @@ -52,4 +54,13 @@ class PositionFragment : private fun navigateToPositionFragment() { findNavController().navigate(R.id.action_positionFragment_to_careerPeriodFragment) } + + private fun shotPositionExposureLogging() { + val scheme = SwmCommonLoggingScheme.Builder() + .setEventLogName("positionExposure") + .setScreenName(this.javaClass) + .setLogData(mapOf("signUpStep" to 7, "seniorStep" to 2)) + .build() + viewModel.shotSwmLogging(scheme) + } } \ No newline at end of file