Skip to content

Commit

Permalink
[ADD/#129] 판매 모듈 amplitude 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchbreeze committed Sep 10, 2024
1 parent 4c3cc13 commit 2ed76dc
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import co.orange.core.amplitude.AmplitudeManager
import co.orange.core.base.BaseActivity
import co.orange.core.extension.initOnBackPressedListener
import co.orange.core.extension.setOnSingleClickListener
Expand All @@ -32,6 +33,7 @@ class AlarmRequestActivity :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

AmplitudeManager.trackEvent("view_sell_push")
initOnBackPressedListener(binding.root)
initExitBtnListener()
initAlarmBtnListener()
Expand All @@ -47,9 +49,11 @@ class AlarmRequestActivity :
private fun initExitBtnListener() {
with(binding) {
btnExit.setOnSingleClickListener {
AmplitudeManager.trackEvent("click_sell_push_refuse")
checkIsBuyOrSell()
}
btnLater.setOnSingleClickListener {
AmplitudeManager.trackEvent("click_sell_push_refuse")
checkIsBuyOrSell()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.viewModels
import co.orange.core.amplitude.AmplitudeManager
import co.orange.core.base.BaseActivity
import co.orange.core.extension.setOnSingleClickListener
import co.orange.core.extension.setPriceForm
Expand Down Expand Up @@ -34,25 +35,31 @@ class SellFinishedActivity :
private fun initReturnBtnListener() {
with(binding) {
btnExit.setOnSingleClickListener { navigationManager.toMainViewWIthClearing(this@SellFinishedActivity) }
btnSellMore.setOnSingleClickListener { navigationManager.toMainViewWIthClearing(this@SellFinishedActivity) }
btnSellMore.setOnSingleClickListener {
AmplitudeManager.trackEvent("click_sell_adjustment_add")
navigationManager.toMainViewWIthClearing(this@SellFinishedActivity)
}
}
}

private fun initDetailBtnListener() {
binding.btnProductDetail.setOnSingleClickListener {
SellInfoActivity.createIntent(this, viewModel.itemId).apply {
startActivity(this)
}
AmplitudeManager.trackEvent("click_sell_adjustment_check")
startActivity(SellInfoActivity.createIntent(this, viewModel.itemId))
}
}

private fun setUiWithIntent() {
intent.getStringExtra(EXTRA_ITEM_ID)?.let { viewModel.itemId = it }
with(binding) {
intent.getStringExtra(EXTRA_ITEM_ID)?.let { viewModel.itemId = it }
intent.getStringExtra(EXTRA_PRODUCT_NAME)?.let { tvFinishedItemName.text = it }
intent.getStringExtra(EXTRA_PRODUCT_IMAGE)?.let { ivFinishedItem.load(it) }
tvFinishedItemPrice.text = intent.getIntExtra(EXTRA_SALE_PRICE, 0).setPriceForm()
}
AmplitudeManager.trackEvent(
"complete_sell_adjustment",
mapOf("item_id" to viewModel.itemId),
)
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.core.view.isVisible
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import co.orange.core.R
import co.orange.core.amplitude.AmplitudeManager
import co.orange.core.base.BaseActivity
import co.orange.core.extension.setOnSingleClickListener
import co.orange.core.extension.setStatusBarColorFromResource
Expand Down Expand Up @@ -41,6 +42,7 @@ class SellOnboardingActivity :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

AmplitudeManager.trackEvent("view_landing_1")
initViewPager()
initExitBtnListener()
initNextBtnListener()
Expand Down Expand Up @@ -69,6 +71,10 @@ class SellOnboardingActivity :
btnNext.setOnClickListener {
vpOnboarding.currentItem += 1
setGuideWIthPosition(vpOnboarding.currentItem)
when (vpOnboarding.currentItem) {
1 -> AmplitudeManager.trackEvent("click_landing_1_next")
2 -> AmplitudeManager.trackEvent("click_landing_2_next")
}
}
}
}
Expand All @@ -88,11 +94,13 @@ class SellOnboardingActivity :

private fun initSelectBtnListener() {
binding.btnSelect.setOnSingleClickListener {
AmplitudeManager.trackEvent("click_landing_3_next")
checkAndGetImage()
}
}

private fun checkAndGetImage() {
AmplitudeManager.trackEvent("view_gallery")
if (ActivityResultContracts.PickVisualMedia.isPhotoPickerAvailable()) {
photoPickerResult.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly))
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.view.View
import android.view.WindowManager
import androidx.fragment.app.activityViewModels
import co.orange.core.R
import co.orange.core.amplitude.AmplitudeManager
import co.orange.core.base.BaseDialog
import co.orange.core.extension.setOnSingleClickListener
import co.orange.sell.databinding.DialogSellProductBinding
Expand Down Expand Up @@ -33,6 +34,7 @@ class SellProductDialog :
) {
super.onViewCreated(view, savedInstanceState)

AmplitudeManager.trackEvent("view_confirm")
initExitBtnListener()
initConfirmBtnListener()
initPickAgainBtnListener()
Expand All @@ -45,18 +47,28 @@ class SellProductDialog :

private fun initConfirmBtnListener() {
binding.btnSubmit.setOnSingleClickListener {
SellProgressActivity.createIntent(
requireContext(),
viewModel.productId,
viewModel.productName,
viewModel.uploadedUrl,
).apply { startActivity(this) }
AmplitudeManager.trackEvent(
"click_confirm_next",
mapOf("product_id" to viewModel.productId),
)
startActivity(
SellProgressActivity.createIntent(
requireContext(),
viewModel.productId,
viewModel.productName,
viewModel.uploadedUrl,
),
)
dismiss()
}
}

private fun initPickAgainBtnListener() {
binding.btnPickAgain.setOnSingleClickListener {
AmplitudeManager.trackEvent(
"click_confirm_quit",
mapOf("product_id" to viewModel.productId),
)
viewModel.setCheckedAgain(true)
dismiss()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.core.view.isVisible
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import co.orange.core.R
import co.orange.core.amplitude.AmplitudeManager
import co.orange.core.base.BaseActivity
import co.orange.core.extension.setOnSingleClickListener
import co.orange.core.extension.setPriceForm
Expand Down Expand Up @@ -47,7 +48,7 @@ class SellProgressActivity :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

binding.vm = viewModel
initView()
initExitBtnListener()
initTermDetailBtnListener()
initRegisterBtnListener()
Expand All @@ -62,8 +63,16 @@ class SellProgressActivity :
getProductWithIdFromIntent()
}

private fun initView() {
binding.vm = viewModel
AmplitudeManager.trackEvent("view_sell", mapOf("product_id" to viewModel.productId))
}

private fun initExitBtnListener() {
binding.btnExit.setOnSingleClickListener { finish() }
binding.btnExit.setOnSingleClickListener {
AmplitudeManager.trackEvent("click_sell_quit")
finish()
}
}

private fun initTermDetailBtnListener() {
Expand All @@ -83,6 +92,10 @@ class SellProgressActivity :

private fun initRegisterBtnListener() {
binding.btnRegister.setOnSingleClickListener {
AmplitudeManager.trackEvent(
"click_sell_next",
mapOf("product_id" to viewModel.productId),
)
with(viewModel) {
setLoadingState(true)
if (isBankExist) {
Expand All @@ -103,6 +116,7 @@ class SellProgressActivity :
}

private fun startSelectingDate() {
AmplitudeManager.trackEvent("click_sell_date")
sellDateBottomSheet = SellDateBottomSheet()
sellDateBottomSheet?.show(supportFragmentManager, BOTTOM_SHEET_DATE)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package co.orange.sell.progress
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import co.orange.core.amplitude.AmplitudeManager
import co.orange.core.state.UiState
import co.orange.domain.entity.request.SellRegisterRequestModel
import co.orange.domain.entity.response.SellProductModel
Expand Down Expand Up @@ -44,6 +45,7 @@ class SellProgressViewModel
val postRegisterState: StateFlow<UiState<SellRegisteredModel>> = _postRegisterState

fun checkAllTerm() {
AmplitudeManager.trackEvent("click_sell_terms_all")
isTermServiceSelected.value = isTermAllSelected.value?.not()
isTermSellSelected.value = isTermAllSelected.value?.not()
isTermAllSelected.value = isTermAllSelected.value?.not()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.core.view.isVisible
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import co.orange.core.R
import co.orange.core.amplitude.AmplitudeManager
import co.orange.core.base.BaseActivity
import co.orange.core.extension.setOnSingleClickListener
import co.orange.core.extension.stringOf
Expand All @@ -29,6 +30,7 @@ class BankActivity : BaseActivity<ActivityBankBinding>(featureR.layout.activity_
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

AmplitudeManager.trackEvent("view_account")
initBackBtnListener()
initBankInfoBtnListener()
observeUserBankState()
Expand All @@ -52,9 +54,7 @@ class BankActivity : BaseActivity<ActivityBankBinding>(featureR.layout.activity_
}

private fun navigateToAddBankView(accountId: Long) {
BankAddActivity.createIntent(this, accountId).apply {
startActivity(this)
}
startActivity(BankAddActivity.createIntent(this, accountId))
}

private fun observeUserBankState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.activity.viewModels
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import co.orange.core.R
import co.orange.core.amplitude.AmplitudeManager
import co.orange.core.base.BaseActivity
import co.orange.core.extension.setOnSingleClickListener
import co.orange.core.extension.stringOf
Expand Down Expand Up @@ -47,6 +48,7 @@ class BankAddActivity : BaseActivity<ActivityBankAddBinding>(featureR.layout.act
}

private fun initConfirmBtnListener() {
AmplitudeManager.trackEvent("click_account_next")
val accountId = intent.getLongExtra(EXTRA_ACCOUNT_ID, -1)
binding.btnConfirm.setOnSingleClickListener {
if (accountId == DEFAULT_ID) {
Expand Down

0 comments on commit 2ed76dc

Please sign in to comment.