Skip to content

Commit

Permalink
[MERGE] #294 -> develop
Browse files Browse the repository at this point in the history
[FEAT/#294] ์— ํ”Œ๋ฆฌํŠœ๋“œ ์ด๋ฒคํŠธ ์‹ฌ๊ธฐ
  • Loading branch information
leeeyubin authored Oct 22, 2024
2 parents 4efc8db + 941b149 commit 14af30d
Show file tree
Hide file tree
Showing 16 changed files with 250 additions and 58 deletions.
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

0 comments on commit 14af30d

Please sign in to comment.