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 16 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 @@ -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
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.flowWithLifecycle
import androidx.navigation.NavHostController
import com.terning.core.analytics.EventType
import com.terning.core.analytics.LocalTracker
import com.terning.core.designsystem.component.topappbar.BackButtonTopAppBar
import com.terning.core.designsystem.theme.CalRed
import com.terning.core.designsystem.theme.Grey200
Expand Down Expand Up @@ -54,6 +56,7 @@ fun InternRoute(
val context = LocalContext.current
val lifecycleOwner = LocalLifecycleOwner.current
val internState by viewModel.internUiState.collectAsStateWithLifecycle(lifecycleOwner)
val amplitudeTracker = LocalTracker.current

LaunchedEffect(key1 = true) {
viewModel.getInternInfo(announcementId)
Expand Down Expand Up @@ -94,6 +97,10 @@ fun InternRoute(
viewModel.updateScrapCancelDialogVisibility(true)
},
onClickScrapButton = {
amplitudeTracker.track(
type = EventType.CLICK,
name = "detail_scrap"
)
viewModel.updateInternDialogVisibility(true)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
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.theme.Grey150
import com.terning.core.designsystem.theme.Grey350
Expand All @@ -27,7 +29,6 @@ import com.terning.core.extension.noRippleClickable
import com.terning.domain.entity.intern.InternInfo
import com.terning.feature.R
import com.terning.feature.intern.InternViewModel
import com.terning.feature.intern.model.InternUiState

@Composable
fun InternBottomBar(
Expand All @@ -36,6 +37,8 @@ fun InternBottomBar(
onScrapClick: (InternInfo) -> Unit,
viewModel: InternViewModel = hiltViewModel(),
) {
val amplitudeTracker = LocalTracker.current

Row(
modifier = modifier
.fillMaxWidth()
Expand Down Expand Up @@ -92,6 +95,10 @@ fun InternBottomBar(
cornerRadius = 10.dp,
text = R.string.intern_move_to_site,
onButtonClick = {
amplitudeTracker.track(
type = EventType.CLICK,
name = "detail_url"
)
viewModel.updateShowWeb(true)
},
)
Expand Down
18 changes: 17 additions & 1 deletion feature/src/main/java/com/terning/feature/main/MainScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.compose.NavHost
import com.terning.core.analytics.EventType
import com.terning.core.analytics.LocalTracker
import com.terning.core.designsystem.component.snackbar.TerningBasicSnackBar
import com.terning.core.designsystem.theme.Grey300
import com.terning.core.designsystem.theme.TerningMain
Expand All @@ -55,6 +57,7 @@ import com.terning.feature.onboarding.splash.navigation.splashNavGraph
import com.terning.feature.search.search.navigation.searchNavGraph
import com.terning.feature.search.searchprocess.navigation.searchProcessNavGraph
import kotlinx.coroutines.launch
import org.openjdk.tools.javac.Main

@Composable
fun MainScreen(
Expand All @@ -67,6 +70,8 @@ fun MainScreen(
val snackBarHostState = remember { SnackbarHostState() }
val coroutineScope = rememberCoroutineScope()

val amplitudeTracker = LocalTracker.current

BackHandler(enabled = backPressedState) {
if (System.currentTimeMillis() - backPressedTime <= 3000) {
(context as Activity).finish()
Expand Down Expand Up @@ -101,7 +106,18 @@ fun MainScreen(
isVisible = navigator.showBottomBar(),
tabs = MainTab.entries.toList(),
currentTab = navigator.currentTab,
onTabSelected = navigator::navigate
onTabSelected = { navigation ->
amplitudeTracker.track(
type = EventType.CLICK,
name = when (navigation) {
MainTab.HOME -> "navigation_home"
MainTab.CALENDAR -> "navigation_calendar"
MainTab.SEARCH -> "navigation_search"
MainTab.MY_PAGE -> "navigation_mypage"
}
)
navigator.navigate(navigation)
}
)
},
) { paddingValues ->
Expand Down
Loading
Loading