Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT/#294] 엠플리튜드 이벤트 심기 #295

Merged
merged 22 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3e46a48
[FEAT/#294] 엠플리튜드 심기
leeeyubin Oct 21, 2024
8be46d2
[FEAT/#294] onboarding filtering amplitude
leeeyubin Oct 21, 2024
390ab58
[FEAT/#294] signup kakao amplitude
leeeyubin Oct 21, 2024
26fccfb
[FEAT/#294] mypage notice amplitude
leeeyubin Oct 21, 2024
d1477b6
[FEAT/#294] mypage comment amplitude
leeeyubin Oct 21, 2024
9bdf61b
[FEAT/#294] mypage modify amplitude
leeeyubin Oct 21, 2024
4d73b0c
[FEAT/#294] mypage logout and quit amplitude
leeeyubin Oct 21, 2024
9aca783
[FEAT/#294] navigation amplitude
leeeyubin Oct 21, 2024
65a1fff
[FEAT/#294] fix code
leeeyubin Oct 21, 2024
dbad766
[FEAT/#294] version update 1.1.5 -> 1.1.6
leeeyubin Oct 22, 2024
f46da5a
[FEAT/#294] search quest scrap amplitude
leeeyubin Oct 22, 2024
10f0f1f
[FEAT/#294] search quest search amplitude
leeeyubin Oct 22, 2024
82d31ce
[FEAT/#294] dialog color and scrap amplitude
leeeyubin Oct 22, 2024
ec63f97
[FEAT/#294] intern detail url amplitude
leeeyubin Oct 22, 2024
2ef1b9e
[FEAT/#294] dialog cancel amplitude
leeeyubin Oct 22, 2024
e46ad2d
[FEAT/#294] intern detail scrap amplitude
leeeyubin Oct 22, 2024
aff07ef
[FEAT/#294] git pull from develop
leeeyubin Oct 22, 2024
f787314
[FEAT/#294] calendar list amplitude
leeeyubin Oct 22, 2024
918454f
[FEAT/#294] home view amplitude
leeeyubin Oct 22, 2024
bb2010f
[FEAT/#294] home filtering amplitude
leeeyubin Oct 22, 2024
59df1b4
[FEAT/#294] home filtering save amplitude
leeeyubin Oct 22, 2024
941b149
[FEAT/#294] home remind card amplitude
leeeyubin Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions core/src/main/java/com/terning/core/analytics/EventType.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.terning.core.analytics

enum class EventType(val prefix: String) {
VIEW("view"),
CLICK("click")
SIGNUP("signup"),
SCREEN("screen"),
CLICK("click"),
SCROLL("scroll")
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.terning.core.analytics.EventType
import com.terning.core.analytics.LocalTracker
import com.terning.core.designsystem.component.topappbar.CalendarTopAppBar
import com.terning.core.designsystem.theme.Grey200
import com.terning.core.designsystem.theme.White
Expand All @@ -45,6 +47,7 @@ fun CalendarRoute(
) {
val lifecycleOwner = LocalLifecycleOwner.current
val uiState by viewModel.uiState.collectAsStateWithLifecycle(lifecycleOwner = lifecycleOwner)
val amplitudeTracker = LocalTracker.current

CalendarScreen(
modifier = modifier,
Expand All @@ -54,7 +57,15 @@ fun CalendarRoute(
updateSelectedDate = viewModel::updateSelectedDate,
disableListVisibility = { viewModel.updateListVisibility(false) },
disableWeekVisibility = { viewModel.updateWeekVisibility(false) },
onClickListButton = { viewModel.updateListVisibility(!uiState.isListEnabled) }
onClickListButton = {
if (!uiState.isListEnabled) {
amplitudeTracker.track(
type = EventType.CLICK,
name = "calendar_list"
)
}
viewModel.updateListVisibility(!uiState.isListEnabled)
}
)
}

Expand Down Expand Up @@ -132,7 +143,7 @@ private fun CalendarScreen(
CalendarMonthRoute(
selectedDate = uiState.selectedDate,
updateSelectedDate = { newDate ->
if(!pagerState.isScrollInProgress)
if (!pagerState.isScrollInProgress)
onClickNewDate(newDate)
},
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.flowWithLifecycle
import com.terning.core.analytics.EventType
import com.terning.core.analytics.LocalTracker
import com.terning.core.designsystem.component.button.RoundButton
import com.terning.core.designsystem.component.dialog.TerningBasicDialog
import com.terning.core.designsystem.component.item.TerningLottieAnimation
Expand All @@ -37,13 +39,16 @@ fun ScrapCancelDialog(
) {
val context = LocalContext.current
val lifecycleOwner = LocalLifecycleOwner.current
val amplitudeTracker = LocalTracker.current

LaunchedEffect(viewModel.sideEffect, lifecycleOwner) {
viewModel.sideEffect.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle)
.collect{ sideEffect ->
when(sideEffect){
.collect { sideEffect ->
when (sideEffect) {
is ScrapCancelSideEffect.DismissDialog -> {
onDismissRequest(true)
}

is ScrapCancelSideEffect.ShowToast -> {
context.toast(sideEffect.message)
}
Expand All @@ -53,7 +58,13 @@ fun ScrapCancelDialog(

ScrapCancelScreen(
onDismissRequest = { onDismissRequest(false) },
onClickScrapCancel = { viewModel.deleteScrap(internshipAnnouncementId) }
onClickScrapCancel = {
amplitudeTracker.track(
type = EventType.CLICK,
name = "detail_cancel_scrap"
)
viewModel.deleteScrap(internshipAnnouncementId)
}
)

}
Expand All @@ -66,48 +77,48 @@ private fun ScrapCancelScreen(
TerningBasicDialog(
onDismissRequest = onDismissRequest
) {
Column(
Column(
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.padding(top = 60.dp)
.padding(horizontal = 16.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
TerningLottieAnimation(
jsonString = "terning_scrap_cancel.json",
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
.padding(top = 60.dp)
.padding(horizontal = 16.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
TerningLottieAnimation(
jsonString = "terning_scrap_cancel.json",
modifier = Modifier
.fillMaxWidth()
.height(203.dp)
)
.height(203.dp)
)

Spacer(modifier = Modifier.height(20.dp))
Spacer(modifier = Modifier.height(20.dp))

Text(
text = stringResource(id = R.string.dialog_content_scrap_cancel_main_title),
textAlign = TextAlign.Center,
style = TerningTheme.typography.title4,
color = Grey500,
)
Text(
text = stringResource(id = R.string.dialog_content_scrap_cancel_main_title),
textAlign = TextAlign.Center,
style = TerningTheme.typography.title4,
color = Grey500,
)

Spacer(modifier = Modifier.height(5.dp))
Spacer(modifier = Modifier.height(5.dp))

Text(
text = stringResource(id = R.string.dialog_content_scrap_cancel_sub_title),
style = TerningTheme.typography.body5,
color = Grey350
)
Spacer(modifier = Modifier.height(40.dp))
Text(
text = stringResource(id = R.string.dialog_content_scrap_cancel_sub_title),
style = TerningTheme.typography.body5,
color = Grey350
)
Spacer(modifier = Modifier.height(40.dp))

RoundButton(
style = TerningTheme.typography.button3,
paddingVertical = 12.dp,
cornerRadius = 8.dp,
text = R.string.dialog_scrap_cancel_button,
onButtonClick = onClickScrapCancel
)
Spacer(modifier = Modifier.height(16.dp))
}
RoundButton(
style = TerningTheme.typography.button3,
paddingVertical = 12.dp,
cornerRadius = 8.dp,
text = R.string.dialog_scrap_cancel_button,
onButtonClick = onClickScrapCancel
)
Spacer(modifier = Modifier.height(16.dp))
}

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.flowWithLifecycle
import coil3.compose.AsyncImage
import coil3.request.ImageRequest
import com.terning.core.analytics.EventType
import com.terning.core.analytics.LocalTracker
import com.terning.core.designsystem.component.button.RoundButton
import com.terning.core.designsystem.component.dialog.TerningBasicDialog
import com.terning.core.designsystem.theme.Grey100
Expand Down Expand Up @@ -73,6 +75,8 @@ fun ScrapDialog(
val context = LocalContext.current
val lifecycleOwner = LocalLifecycleOwner.current
val uiState by viewModel.uiState.collectAsStateWithLifecycle(lifecycleOwner = lifecycleOwner)
val amplitudeTracker = LocalTracker.current

LaunchedEffect(viewModel.sideEffect, lifecycleOwner) {
viewModel.sideEffect.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle)
.collect { sideEffect ->
Expand Down Expand Up @@ -123,21 +127,29 @@ fun ScrapDialog(
isColorChanged = uiState.isColorChanged,
onClickColorButton = viewModel::changeSelectedColor,
onClickColorChangeButton = {
if (uiState.isColorChanged)
if (uiState.isColorChanged) {
amplitudeTracker.track(
type = EventType.CLICK,
name = "modal_color"
)
viewModel.patchScrap(
scrapId = internshipAnnouncementId,
color = uiState.selectedColorType
)
}
},
onClickNavigateButton = viewModel::navigateToDetail,
onClickScrapButton = {
amplitudeTracker.track(
type = EventType.CLICK,
name = "modal_calender"
)
viewModel.postScrap(internshipAnnouncementId, uiState.selectedColorType)
}
)
}
}


@Composable
private fun ScrapDialogScreen(
title: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.flowWithLifecycle
import com.terning.core.analytics.EventType
import com.terning.core.analytics.LocalTracker
import com.terning.core.designsystem.component.button.RectangleButton
import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar
import com.terning.core.designsystem.theme.Grey300
Expand All @@ -49,6 +51,8 @@ fun FilteringThreeRoute(
val context = LocalContext.current
val lifecycleOwner = LocalLifecycleOwner.current

val amplitudeTracker = LocalTracker.current

LaunchedEffect(key1 = true) {
with(viewModel) {
updateGrade(grade = grade)
Expand Down Expand Up @@ -78,7 +82,19 @@ fun FilteringThreeRoute(
navigateUp = viewModel::navigateUp,
chosenYear = Calendar.getInstance().currentYear,
chosenMonth = Calendar.getInstance().currentMonth,
onNextClick = viewModel::postFilteringWithServer,
onNextClick = {
amplitudeTracker.track(
type = EventType.CLICK,
name = "onboarding_completed",
properties = mapOf(
"grade" to state.grade,
"workingPeriod" to state.workingPeriod,
"startYear" to state.startYear,
"startMonth" to state.startMonth
)
)
viewModel.postFilteringWithServer()
},
onYearChosen = viewModel::updateStartYear,
onMonthChosen = viewModel::updateStartMonth
)
Expand Down
44 changes: 40 additions & 4 deletions feature/src/main/java/com/terning/feature/home/HomeRoute.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.flowWithLifecycle
import androidx.navigation.NavHostController
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import com.terning.core.analytics.EventType
import com.terning.core.analytics.LocalTracker
import com.terning.core.designsystem.component.bottomsheet.SortingBottomSheet
import com.terning.core.designsystem.component.button.SortingButton
import com.terning.core.designsystem.component.image.TerningImage
Expand Down Expand Up @@ -80,6 +82,8 @@ fun HomeRoute(
val lifecycleOwner = LocalLifecycleOwner.current
val context = LocalContext.current

val amplitudeTracker = LocalTracker.current

LaunchedEffect(key1 = true) {
viewModel.getProfile()
viewModel.getFilteringInfo()
Expand All @@ -97,8 +101,20 @@ fun HomeRoute(

HomeScreen(
paddingValues = paddingValues,
navigateToIntern = { navController.navigateIntern(announcementId = it) },
navigateToCalendar = { navController.navigateCalendar() },
navigateToIntern = {
amplitudeTracker.track(
type = EventType.CLICK,
name = "home_intern_card"
)
navController.navigateIntern(announcementId = it)
},
navigateToCalendar = {
amplitudeTracker.track(
type = EventType.CLICK,
name = "check_schedule"
)
navController.navigateCalendar()
},
updateRecommendDialogVisibility = viewModel::updateRecommendDialogVisibility,
updateUpcomingDialogVisibility = viewModel::updateUpcomingDialogVisibility,
getHomeUpcomingInternList = viewModel::getHomeUpcomingInternList,
Expand Down Expand Up @@ -143,15 +159,27 @@ fun HomeScreen(

var changeFilteringSheetState by remember { mutableStateOf(false) }

val amplitudeTracker = LocalTracker.current

if (homeState.sortingSheetVisibility) {
SortingBottomSheet(
onDismiss = {
viewModel.updateSortingSheetVisibility(false)
},
currentSortBy = homeState.sortBy.ordinal,
onSortChange = {
onSortChange = { sortBy ->
amplitudeTracker.track(
type = EventType.CLICK,
name = when (sortBy) {
0 -> "filtered_deadline"
1 -> "filtered_short_term"
2 -> "filtered_long_term"
3 -> "filtered_scraps"
else -> "filtered_hits"
}
)
viewModel.updateSortBy(
it,
sortBy,
homeFilteringInfo.startYear,
homeFilteringInfo.startMonth,
)
Expand All @@ -169,6 +197,10 @@ fun HomeScreen(
defaultStartMonth = homeFilteringInfo.startMonth,
onDismiss = { changeFilteringSheetState = false },
onChangeButtonClick = { grade, workingPeriod, year, month ->
amplitudeTracker.track(
type = EventType.CLICK,
name = "home_filtering_save"
)
viewModel.putFilteringInfo(grade, workingPeriod, year, month)
changeFilteringSheetState = false
}
Expand Down Expand Up @@ -316,6 +348,10 @@ fun HomeScreen(
navigateToIntern = navigateToIntern,
intern = homeRecommendInternList[index],
onScrapButtonClicked = {
amplitudeTracker.track(
type = EventType.CLICK,
name = "home_scrap"
)
updateRecommendDialogVisibility(true)
with(homeRecommendInternList[index]) {
viewModel.updateHomeInternModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.terning.core.analytics.EventType
import com.terning.core.analytics.LocalTracker
import com.terning.core.designsystem.theme.Grey350
import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.TerningMain
Expand All @@ -46,6 +48,8 @@ fun HomeFilteringScreen(
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
val amplitudeTracker = LocalTracker.current

Row(
modifier = Modifier
.border(
Expand All @@ -54,7 +58,13 @@ fun HomeFilteringScreen(
shape = RoundedCornerShape(5.dp)
)
.align(Alignment.CenterVertically)
.noRippleClickable(onChangeFilterClick),
.noRippleClickable {
amplitudeTracker.track(
type = EventType.CLICK,
name = "home_filtering"
)
onChangeFilterClick()
},
) {
Icon(
painter = painterResource(id = R.drawable.ic_home_filtering_28),
Expand Down
Loading
Loading