Skip to content

Commit

Permalink
[FEAT] SignIn ExposureLogging (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
KxxHyoRim committed Nov 13, 2023
1 parent 8c202ce commit 27a39a0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.lgtm.domain.logging

import com.swm.logging.android.logging_scheme.ClickScheme
import com.swm.logging.android.logging_scheme.SWMLoggingScheme
import java.lang.reflect.Type

class CommonLoggingScheme(
class SwmCommonLoggingScheme(
eventLogName: String,
screenName: String,
logVersion: String,
logData: Map<String, Any>,
) : ClickScheme() {
) : SWMLoggingScheme() {

init {
setLoggingScheme(
Expand Down Expand Up @@ -52,11 +52,11 @@ class CommonLoggingScheme(
return this
}

fun build(): CommonLoggingScheme {
fun build(): SwmCommonLoggingScheme {
check(::eventLogName.isInitialized) { "eventLogName is not initialized" }
check(::screenName.isInitialized) { "screenName is not initialized" }

return CommonLoggingScheme(
return SwmCommonLoggingScheme(
eventLogName,
screenName,
logVersion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.lgtm.android.auth.ui.signup.SignUpActivity
import com.lgtm.android.common_ui.base.BaseActivity
import com.lgtm.android.common_ui.util.NetworkState
import com.lgtm.android.common_ui.util.setOnThrottleClickListener
import com.lgtm.domain.logging.SwmCommonLoggingScheme
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
Expand All @@ -31,6 +32,7 @@ class SignInActivity : BaseActivity<ActivitySignInBinding>(R.layout.activity_sig
initClickListener()
observeGithubLoginResponse()
observePatchDeviceTokenStatus()
shotSignInExposureLogging()
}

private fun setAnimationOnGithubButton() {
Expand Down Expand Up @@ -118,6 +120,15 @@ class SignInActivity : BaseActivity<ActivitySignInBinding>(R.layout.activity_sig
Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
}

private fun shotSignInExposureLogging() {
val scheme = SwmCommonLoggingScheme.Builder()
.setEventLogName("signInExposure")
.setScreenName(this.javaClass)
.build()
signInViewModel.shotSignInExposureLogging(scheme)
}


companion object {
const val MEMBER_DATA = "memberData"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import com.lgtm.android.common_ui.util.NetworkState
import com.lgtm.domain.entity.LgtmResponseException
import com.lgtm.domain.entity.response.GithubLoginResponse
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 @@ -86,4 +88,8 @@ class SignInViewModel @Inject constructor(
}
}
}

fun shotSignInExposureLogging(scheme: SWMLoggingScheme) {
SWMLogging.logEvent(scheme)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import com.lgtm.android.auth.databinding.ActivitySplashBinding
import com.lgtm.android.auth.ui.SignInActivity
import com.lgtm.android.auth.ui.SystemMaintenanceActivity
import com.lgtm.android.common_ui.base.BaseActivity
import com.lgtm.domain.logging.CommonLoggingScheme
import com.lgtm.domain.logging.SwmCommonLoggingScheme
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
Expand All @@ -33,7 +33,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(R.layout.activity_spl
}

private fun shotSplashExposureLogging() {
val scheme = CommonLoggingScheme.Builder()
val scheme = SwmCommonLoggingScheme.Builder()
.setEventLogName("splashExposure")
.setScreenName(this.javaClass)
.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ object SWMLogging {
observable.onNext(swmLoggingScheme)
}

suspend fun shotLogging(swmLoggingScheme: SWMLoggingScheme): Response<BaseDTO> {
private suspend fun shotLogging(swmLoggingScheme: SWMLoggingScheme): Response<BaseDTO> {
checkInitialized()
return loggingService.postLogging(serverPath, swmLoggingScheme)
}
Expand Down

0 comments on commit 27a39a0

Please sign in to comment.