Skip to content

Commit

Permalink
[feat]: 이벤트 로그 등록
Browse files Browse the repository at this point in the history
  • Loading branch information
jinuemong committed Mar 10, 2024
1 parent 8cee701 commit e55aa20
Show file tree
Hide file tree
Showing 13 changed files with 314 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package ac.dnd.mour.android.presentation.common.util.logevent

import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.analytics.logEvent
import com.google.firebase.ktx.Firebase

fun viewLogEvent(
eventName: String,
screenName: String
) {
Firebase.analytics.logEvent(eventName) {
param(screenName, screenName)
}
}

object LogEventUtil {
const val VIEW_LOG_IN = "view_log_in"
const val CLICK_KAKAO_LOG_IN = "click_kakao_log_in"

const val VIEW_ONBOARDING = "View_onboarding"
const val CLICK_NEXT_ONBOARDING = "click_next_onboarding"
const val VIEW_ONBOARDING_SECOND = "View_onboarding_second"
const val CLICK_NEXT_ONBOARDING_SECOND = "click_next_onboarding_second"
const val VIEW_ONBOARDING_THIRD = "View_onboarding_third"
const val CLICK_NEXT_ONBOARDING_THIRD = "click_next_onboarding_third"

const val VIEW_REQUIRED_INFO = "View_Required_info"
const val CLICK_START_REQUIRED_INFO = "click_start_Required_info"

const val CLICK_PLUSBTN_MAIN = "click_Plusbtn_main"
const val VIEW_MAIN = "View_main"
const val CLICK_PLUSFLOATING_MAIN = "click_Plusfloating_main"

const val VIEW_FAB_BUTTON_MAIN = "View_FAB_button_main"
const val CLICK_MONEY_MAIN = "click_money_main"
const val CLICK_RELATION_MAIN = "click_relation_main"
const val CLICK_CLOSE_MAIN = "click_close_main"

const val VIEW_RELATION = "View_relation"
const val CLICK_DIRECT_INPUT_RELATION = "click_Direct_input_relation"
const val CLICK_MONEY_RELATION = "click_money_relation"
const val CLICK_KAKAO_RELATION = "click_kakao_relation"
const val CLICK_EDIT_RELATION = "click_edit_relation"
const val CLICK_SAVE_RELATION = "click_save_relation"

const val VIEW_EDIT_GROUP = "View_Edit_group"
const val CLICK_SAVE_GROUP_EDIT_GROUP = "click_save_group_edit_group"

const val VIEW_ADD_NEW_GROUP = "View_Add_new_group"
const val CLICK_REGISTRATION_ADD_NEW_GROUP = "click_registration_Add_new_group"

const val VIEW_MONEY_TAKE = "View_money_take"
const val CLICK_NEXT_SAVE_TAKE = "click_next_save_take"
const val CLICK_SAVE_TAKE = "click_save_take"

const val VIEW_MONEY_GIVE = "View_money_give"
const val CLICK_NEXT_SAVE_GIVE = "click_next_save_give"
const val CLICK_SAVE_GIVE = "click_save_give"

const val VIEW_SELECT_NAME = "View_select_name"
const val CLICK_SAVE_RELATION_SELECT_NAME = "click_save_relation_select_name"
const val CLICK_SELECION_NAME = "click_selecion_name"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import ac.dnd.mour.android.presentation.common.util.LaunchedEffectWithLifecycle
import ac.dnd.mour.android.presentation.common.util.coroutine.event.EventFlow
import ac.dnd.mour.android.presentation.common.util.coroutine.event.MutableEventFlow
import ac.dnd.mour.android.presentation.common.util.coroutine.event.eventObserve
import ac.dnd.mour.android.presentation.common.util.logevent.LogEventUtil
import ac.dnd.mour.android.presentation.common.util.logevent.viewLogEvent
import ac.dnd.mour.android.presentation.common.view.BottomSheetScreen
import ac.dnd.mour.android.presentation.common.view.confirm.ConfirmButton
import ac.dnd.mour.android.presentation.common.view.confirm.ConfirmButtonProperties
Expand All @@ -41,6 +43,7 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -73,6 +76,13 @@ fun AddGroupScreen(
}
ErrorObserver(viewModel)

LaunchedEffect(Unit) {
viewLogEvent(
LogEventUtil.VIEW_ADD_NEW_GROUP,
LogEventUtil.VIEW_ADD_NEW_GROUP
)
}

AddGroupScreen(
appState = appState,
model = model,
Expand Down Expand Up @@ -192,6 +202,10 @@ private fun AddGroupScreen(
),
isEnabled = text.isNotEmpty(),
onClick = {
viewLogEvent(
LogEventUtil.VIEW_ADD_NEW_GROUP,
LogEventUtil.CLICK_REGISTRATION_ADD_NEW_GROUP
)
intent(AddGroupIntent.OnConfirm(text))
}
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import ac.dnd.mour.android.presentation.common.util.LaunchedEffectWithLifecycle
import ac.dnd.mour.android.presentation.common.util.coroutine.event.EventFlow
import ac.dnd.mour.android.presentation.common.util.coroutine.event.MutableEventFlow
import ac.dnd.mour.android.presentation.common.util.coroutine.event.eventObserve
import ac.dnd.mour.android.presentation.common.util.logevent.LogEventUtil
import ac.dnd.mour.android.presentation.common.util.logevent.viewLogEvent
import ac.dnd.mour.android.presentation.common.view.BottomSheetScreen
import ac.dnd.mour.android.presentation.common.view.confirm.ConfirmButton
import ac.dnd.mour.android.presentation.common.view.confirm.ConfirmButtonProperties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import ac.dnd.mour.android.presentation.common.util.LaunchedEffectWithLifecycle
import ac.dnd.mour.android.presentation.common.util.coroutine.event.EventFlow
import ac.dnd.mour.android.presentation.common.util.coroutine.event.MutableEventFlow
import ac.dnd.mour.android.presentation.common.util.coroutine.event.eventObserve
import ac.dnd.mour.android.presentation.common.util.logevent.LogEventUtil
import ac.dnd.mour.android.presentation.common.util.logevent.viewLogEvent
import ac.dnd.mour.android.presentation.common.view.BottomSheetScreen
import ac.dnd.mour.android.presentation.common.view.DialogScreen
import ac.dnd.mour.android.presentation.model.relation.DefaultGroupType
Expand Down Expand Up @@ -49,6 +51,7 @@ import androidx.compose.material.DropdownMenu
import androidx.compose.material.DropdownMenuItem
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
Expand Down Expand Up @@ -87,6 +90,13 @@ fun GetGroupScreen(
}
ErrorObserver(viewModel)

LaunchedEffect(Unit) {
viewLogEvent(
LogEventUtil.VIEW_EDIT_GROUP,
LogEventUtil.VIEW_EDIT_GROUP
)
}

GetGroupScreen(
appState = appState,
onDismissRequest = onDismissRequest,
Expand Down Expand Up @@ -298,6 +308,10 @@ private fun GetGroupScreen(
Row(
modifier = Modifier
.clickable {
viewLogEvent(
LogEventUtil.VIEW_EDIT_GROUP,
LogEventUtil.CLICK_SAVE_GROUP_EDIT_GROUP
)
isShowingAddGroupSheet = true
}
.padding(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import ac.dnd.mour.android.presentation.common.util.coroutine.event.EventFlow
import ac.dnd.mour.android.presentation.common.util.coroutine.event.MutableEventFlow
import ac.dnd.mour.android.presentation.common.util.coroutine.event.eventObserve
import ac.dnd.mour.android.presentation.common.util.expansion.addFocusCleaner
import ac.dnd.mour.android.presentation.common.util.logevent.LogEventUtil
import ac.dnd.mour.android.presentation.common.util.logevent.viewLogEvent
import ac.dnd.mour.android.presentation.common.util.makeRoute
import ac.dnd.mour.android.presentation.common.view.DialogScreen
import ac.dnd.mour.android.presentation.common.view.SnackBarScreen
Expand Down Expand Up @@ -122,6 +124,14 @@ fun RelationScreen(
handler: CoroutineExceptionHandler
) {

LaunchedEffect(Unit) {
if (relationType == RelationType.ADD) {
viewLogEvent(
LogEventUtil.VIEW_RELATION,
LogEventUtil.VIEW_RELATION
)
}
}
appState.setStatusBarColor(Gray000)

val scope = rememberCoroutineScope()
Expand Down Expand Up @@ -390,6 +400,12 @@ fun RelationScreen(
chipId = 0,
onSelectChip = {
isNameTypeTyping = true
if (relationType == RelationType.ADD) {
viewLogEvent(
LogEventUtil.VIEW_RELATION,
LogEventUtil.CLICK_DIRECT_INPUT_RELATION
)
}
}
)
ChipItem(
Expand All @@ -402,6 +418,12 @@ fun RelationScreen(
intent(RelationIntent.OnClickLoadFriend)
}
isNameTypeTyping = false
if (relationType == RelationType.ADD) {
viewLogEvent(
LogEventUtil.VIEW_RELATION,
LogEventUtil.CLICK_KAKAO_RELATION
)
}
}
)
}
Expand Down Expand Up @@ -598,6 +620,12 @@ fun RelationScreen(
.clip(Shapes.medium)
.background(color = Gray200)
.clickable {
if (relationType == RelationType.ADD) {
viewLogEvent(
LogEventUtil.VIEW_RELATION,
LogEventUtil.CLICK_EDIT_RELATION
)
}
isShowingGetGroup = true
}
.padding(
Expand Down Expand Up @@ -809,6 +837,10 @@ fun RelationScreen(
onClick = {
if (checkSubmitState()) {
isRecordState = true
viewLogEvent(
LogEventUtil.VIEW_RELATION,
LogEventUtil.CLICK_MONEY_RELATION
)
intent(
if (currentImageName.isEmpty()) {
RelationIntent.OnClickAdd(
Expand Down Expand Up @@ -847,6 +879,10 @@ fun RelationScreen(
},
onClick = {
if (checkSubmitState()) {
viewLogEvent(
LogEventUtil.VIEW_RELATION,
LogEventUtil.CLICK_SAVE_RELATION
)
intent(
if (currentImageName.isEmpty()) {
RelationIntent.OnClickAdd(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import ac.dnd.mour.android.presentation.common.util.LaunchedEffectWithLifecycle
import ac.dnd.mour.android.presentation.common.util.coroutine.event.EventFlow
import ac.dnd.mour.android.presentation.common.util.coroutine.event.MutableEventFlow
import ac.dnd.mour.android.presentation.common.util.coroutine.event.eventObserve
import ac.dnd.mour.android.presentation.common.util.logevent.LogEventUtil
import ac.dnd.mour.android.presentation.common.util.logevent.viewLogEvent
import ac.dnd.mour.android.presentation.common.view.BottomSheetScreen
import ac.dnd.mour.android.presentation.common.view.confirm.ConfirmButton
import ac.dnd.mour.android.presentation.common.view.confirm.ConfirmButtonProperties
Expand Down Expand Up @@ -62,6 +64,7 @@ import androidx.compose.material.Icon
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -103,6 +106,13 @@ fun SearchRelationScreen(
}
ErrorObserver(viewModel)

LaunchedEffect(Unit){
viewLogEvent(
LogEventUtil.VIEW_SELECT_NAME,
LogEventUtil.VIEW_SELECT_NAME
)
}

SearchRelationScreen(
appState = appState,
model = model,
Expand Down Expand Up @@ -273,6 +283,10 @@ private fun SearchRelationScreen(
modifier = Modifier
.clip(Shapes.medium)
.clickable {
viewLogEvent(
LogEventUtil.VIEW_SELECT_NAME,
LogEventUtil.CLICK_SAVE_RELATION_SELECT_NAME
)
navigateToEditRelation()
}
.background(color = Gray000)
Expand Down Expand Up @@ -384,6 +398,10 @@ private fun SearchRelationScreen(
),
isEnabled = selectedRelation != null,
onClick = {
viewLogEvent(
LogEventUtil.VIEW_SELECT_NAME,
LogEventUtil.CLICK_SELECION_NAME
)
selectedRelation?.let { relation ->
onResult(relation)
onDismissRequest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import ac.dnd.mour.android.presentation.common.theme.Space16
import ac.dnd.mour.android.presentation.common.theme.Space24
import ac.dnd.mour.android.presentation.common.theme.Space4
import ac.dnd.mour.android.presentation.common.util.coroutine.event.EventFlow
import ac.dnd.mour.android.presentation.common.util.logevent.LogEventUtil
import ac.dnd.mour.android.presentation.common.util.logevent.viewLogEvent
import ac.dnd.mour.android.presentation.common.util.makeRoute
import ac.dnd.mour.android.presentation.common.view.chip.ChipItem
import ac.dnd.mour.android.presentation.common.view.chip.ChipType
Expand Down Expand Up @@ -411,6 +413,10 @@ private fun EmptyRelationView(
.background(color = Gray000)
.clickable {
onRecord()
viewLogEvent(
LogEventUtil.VIEW_MAIN,
LogEventUtil.CLICK_PLUSBTN_MAIN
)
}
.border(
width = 1.dp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import ac.dnd.mour.android.presentation.common.util.coroutine.event.EventFlow
import ac.dnd.mour.android.presentation.common.util.coroutine.event.MutableEventFlow
import ac.dnd.mour.android.presentation.common.util.coroutine.event.eventObserve
import ac.dnd.mour.android.presentation.common.util.expansion.addFocusCleaner
import ac.dnd.mour.android.presentation.common.util.logevent.LogEventUtil
import ac.dnd.mour.android.presentation.common.util.logevent.viewLogEvent
import ac.dnd.mour.android.presentation.common.view.textfield.TypingTextField
import ac.dnd.mour.android.presentation.common.view.textfield.TypingTextFieldType
import ac.dnd.mour.android.presentation.model.history.HistoryViewSwipingType
Expand Down Expand Up @@ -105,6 +107,7 @@ import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.launch
import kotlinx.datetime.LocalDate
import kotlinx.datetime.LocalTime
import timber.log.Timber

@Composable
fun HistoryScreen(
Expand Down Expand Up @@ -149,6 +152,12 @@ private fun HistoryScreen(
handler: CoroutineExceptionHandler,
selectedItem: Int
) {
LaunchedEffect(Unit){
viewLogEvent(
LogEventUtil.VIEW_MAIN,
LogEventUtil.VIEW_MAIN
)
}

var isViewInLifecycle by remember { mutableStateOf(true) }
LaunchedEffectWithLifecycle(context = handler) {
Expand Down Expand Up @@ -527,6 +536,10 @@ private fun HistoryScreen(
)
.clip(RoundedCornerShape(100.dp))
.clickable {
viewLogEvent(
LogEventUtil.VIEW_FAB_BUTTON_MAIN,
LogEventUtil.CLICK_MONEY_MAIN
)
isDropDownMenuExpanded = false
if (isNotEmptyRelation) {
isDropDownMenuExpanded = false
Expand Down Expand Up @@ -574,6 +587,10 @@ private fun HistoryScreen(
)
.clip(RoundedCornerShape(100.dp))
.clickable {
viewLogEvent(
LogEventUtil.VIEW_FAB_BUTTON_MAIN,
LogEventUtil.CLICK_RELATION_MAIN
)
isDropDownMenuExpanded = false
navigateToAddRelation()
}
Expand Down Expand Up @@ -620,6 +637,21 @@ private fun HistoryScreen(
backgroundColor = if (isDropDownMenuExpanded) Gray000 else Gray800,
onClick = {
isDropDownMenuExpanded = !isDropDownMenuExpanded
if(isDropDownMenuExpanded){
viewLogEvent(
LogEventUtil.VIEW_FAB_BUTTON_MAIN,
LogEventUtil.CLICK_CLOSE_MAIN
)
}else{
viewLogEvent(
LogEventUtil.VIEW_MAIN,
LogEventUtil.CLICK_PLUSFLOATING_MAIN
)
viewLogEvent(
LogEventUtil.VIEW_FAB_BUTTON_MAIN,
LogEventUtil.VIEW_FAB_BUTTON_MAIN
)
}
}
) {
if (isDropDownMenuExpanded) {
Expand Down
Loading

0 comments on commit e55aa20

Please sign in to comment.