Skip to content

Commit

Permalink
[FEAT] SignUp Process ExposureLogging Complete (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
KxxHyoRim committed Nov 13, 2023
1 parent f856e9f commit 38df120
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -314,14 +312,14 @@ class SignUpViewModel @Inject constructor(
}

private val _accountNumber = MutableLiveData<String>()
private val accountNumber: LiveData<String> = _accountNumber
val accountNumber: LiveData<String> = _accountNumber

fun setAccountNumber(number: String) {
_accountNumber.value = number
}

private val _accountHolder = MutableLiveData<String>()
private val accountHolder: LiveData<String> = _accountHolder
val accountHolder: LiveData<String> = _accountHolder

fun setAccountHolder(holder: String) {
_accountHolder.value = holder
Expand Down Expand Up @@ -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<Int>()
val selectedBankIdx: LiveData<Int> = _selectedBankIdx
fun setSelectedBankIdx(position: Int) {
_selectedBankIdx.value = position
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ChooseRoleFragment : BaseFragment<FragmentChooseRoleBinding>(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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,6 +26,7 @@ class TechTagFragment : BaseFragment<FragmentTechTagBinding>(R.layout.fragment_t
setChips()
observeTechTagList()
setupNextButtonListener()
shotTechTagExposureLogging()
}

private fun setupViewModel() {
Expand Down Expand Up @@ -53,4 +55,13 @@ class TechTagFragment : BaseFragment<FragmentTechTagBinding>(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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class RealNameFragment : BaseFragment<FragmentRealNameBinding>(R.layout.fragment

is NetworkState.Failure -> {
Toast.makeText(requireContext(), it.msg, Toast.LENGTH_SHORT).show()
signUpViewModel.clearSignUpState()
}
}
}
Expand All @@ -79,7 +80,7 @@ class RealNameFragment : BaseFragment<FragmentRealNameBinding>(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)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
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
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
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<FragmentBankAccountBinding>(R.layout.fragment_bank_account) {
private val signUpViewModel by activityViewModels<SignUpViewModel>()
private lateinit var bankAdapter : BankSpinnerAdapter
override fun initializeViewModel() {
viewModel = signUpViewModel
}
Expand All @@ -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())
Expand All @@ -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
}

Expand All @@ -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()
}
Expand Down Expand Up @@ -93,6 +104,7 @@ class BankAccountFragment :

is NetworkState.Failure -> {
Toast.makeText(requireContext(), it.msg, Toast.LENGTH_SHORT).show()
signUpViewModel.clearSignUpState()
}
}
}
Expand All @@ -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)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand All @@ -23,6 +24,7 @@ class CareerPeriodFragment :
setupViewModel()
onCareerPeriodChanged()
setupNextButtonListener()
shotCareerPeriodExposureLogging()
}


Expand All @@ -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)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<FragmentCompanyNameBinding>(R.layout.fragment_company_name) {
Expand All @@ -22,6 +23,7 @@ class CompanyNameFragment :
setupEditText()
onCompanyNameChanged()
setupNextButtonListener()
shotCompanyNameExposureLogging()
}

private fun setupViewModel() {
Expand Down Expand Up @@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<FragmentPositionBinding>(R.layout.fragment_position) {
Expand All @@ -22,6 +23,7 @@ class PositionFragment :
setupEditText()
onPositionNameChanged()
setupNextButtonListener()
shotPositionExposureLogging()
}

private fun setupViewModel() {
Expand Down Expand Up @@ -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)
}
}

0 comments on commit 38df120

Please sign in to comment.