Skip to content

Commit a7774b4

Browse files
committed
♻️ Refactor: monthChangeFlow collectMonthChange() 함수로 추출
1 parent dc95cbb commit a7774b4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

feature/main/src/main/java/com/twix/stats/StatsViewModel.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ class StatsViewModel(
4444
)
4545

4646
init {
47+
collectMonthChange()
48+
fetchInProgressStats(YearMonth.from(currentState.currentDate))
49+
fetchCompletedStats()
50+
collectEventBus()
51+
}
52+
53+
private fun collectMonthChange() {
4754
viewModelScope.launch {
4855
monthChangeFlow
4956
.distinctUntilChanged()
@@ -52,10 +59,6 @@ class StatsViewModel(
5259
fetchInProgressStats(yearMonth)
5360
}
5461
}
55-
56-
fetchInProgressStats(YearMonth.from(currentState.currentDate))
57-
fetchCompletedStats()
58-
collectEventBus()
5962
}
6063

6164
override suspend fun handleIntent(intent: StatsIntent) {

0 commit comments

Comments
 (0)