Skip to content

Commit

Permalink
Feat : 홈 이벤트 수집
Browse files Browse the repository at this point in the history
  • Loading branch information
DongChyeon committed Aug 2, 2024
1 parent 911964b commit ccc951c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion feature/home/src/main/java/com/teamwiney/home/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import androidx.paging.compose.collectAsLazyPagingItems
import androidx.paging.compose.itemContentType
import androidx.paging.compose.itemKey
import com.teamwiney.analysis.component.TipCard
import com.teamwiney.core.common.AmplitudeEvent
import com.teamwiney.core.common.WineyAppState
import com.teamwiney.core.common.AmplitudeProvider
import com.teamwiney.core.common.navigation.HomeDestinations
Expand All @@ -74,6 +75,10 @@ fun HomeScreen(
val wineTips = uiState.wineTips.collectAsLazyPagingItems()
val wineTipsRefreshState = wineTips.loadState.refresh

LaunchedEffect(true) {
AmplitudeProvider.trackEvent(AmplitudeEvent.HOME_ENTER)
}

LaunchedEffect(wineTipsRefreshState) {
if (wineTipsRefreshState is LoadState.Error) {
val errorMessage = wineTipsRefreshState.error.message ?: "네트워크 오류가 발생했습니다."
Expand Down Expand Up @@ -111,7 +116,7 @@ fun HomeScreen(
HomeLogo(
onClick = {
viewModel.processEvent(HomeContract.Event.ShowAnalysis)
AmplitudeProvider.trackEvent("analysis_button_click")
AmplitudeProvider.trackEvent(AmplitudeEvent.ANALYZE_BUTTON_CLICK)
},
hintPopupOpen = uiState.isFirstScroll
)
Expand Down Expand Up @@ -194,6 +199,7 @@ fun HomeWineTips(
thumbnail = it.thumbnail,
onClick = {
viewModel.processEvent(HomeContract.Event.ShowTipDetail(it.url))
AmplitudeProvider.trackEvent(AmplitudeEvent.TIP_POST_CLICK)
}
)
}
Expand Down Expand Up @@ -290,6 +296,7 @@ private fun HomeRecommendWine(
},
onShowDetail = {
processEvent(HomeContract.Event.ShowWineCardDetail(recommendWines[page].wineId))
AmplitudeProvider.trackEvent(AmplitudeEvent.WINE_DETAIL_CLICK)
},
color = recommendWines[page].type,
name = recommendWines[page].name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class HomeViewModel @Inject constructor(
}
}

fun getRecommendWines() = viewModelScope.launch {
private fun getRecommendWines() = viewModelScope.launch {
wineRepository.getRecommendWines().onStart {
updateState(currentState.copy(isLoading = true))
}.collectLatest {
Expand Down Expand Up @@ -130,7 +130,7 @@ class HomeViewModel @Inject constructor(
}
}

fun getWineTips() = viewModelScope.launch {
private fun getWineTips() = viewModelScope.launch {
updateState(
currentState.copy(
wineTips = Pager(
Expand Down

0 comments on commit ccc951c

Please sign in to comment.