Skip to content

Commit be5d9a0

Browse files
committed
[BOOK-124] chore: 중복된 getCurrentTab 함수 제거
1 parent 5671692 commit be5d9a0

File tree

2 files changed

+14
-24
lines changed

2 files changed

+14
-24
lines changed

feature/main/src/main/kotlin/com/ninecraft/booket/feature/main/component/MainBottomBar.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,6 @@ private fun RowScope.MainBottomBarItem(
126126
}
127127
}
128128

129-
@ComponentPreview
130-
@Composable
131-
private fun MainBottomBarPreview() {
132-
ReedTheme {
133-
MainBottomBar(
134-
tabs = MainTab.entries.toImmutableList(),
135-
currentTab = MainTab.HOME,
136-
onTabSelected = {},
137-
)
138-
}
139-
}
140-
141129
fun Navigator.popUntilOrGoTo(screen: Screen) {
142130
if (screen in peekBackStack()) {
143131
popUntil { it == screen }
@@ -147,9 +135,21 @@ fun Navigator.popUntilOrGoTo(screen: Screen) {
147135
}
148136

149137
@Composable
150-
private fun getCurrentTab(backStack: SaveableBackStack): MainTab? {
138+
fun getCurrentTab(backStack: SaveableBackStack): MainTab? {
151139
val currentScreen = backStack.topRecord?.screen
152140
return currentScreen?.let { screen ->
153141
MainTab.entries.find { it.screen::class == currentScreen::class }
154142
}
155143
}
144+
145+
@ComponentPreview
146+
@Composable
147+
private fun MainBottomBarPreview() {
148+
ReedTheme {
149+
MainBottomBar(
150+
tabs = MainTab.entries.toImmutableList(),
151+
currentTab = MainTab.HOME,
152+
onTabSelected = {},
153+
)
154+
}
155+
}

feature/main/src/main/kotlin/com/ninecraft/booket/feature/main/screens/BottomNavigationPresenter.kt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ package com.ninecraft.booket.feature.main.screens
22

33
import androidx.compose.runtime.Composable
44
import androidx.compose.runtime.remember
5-
import com.ninecraft.booket.feature.main.component.MainTab
5+
import com.ninecraft.booket.feature.main.component.getCurrentTab
66
import com.ninecraft.booket.screens.BottomNavigationScreen
77
import com.ninecraft.booket.screens.HomeScreen
8-
import com.slack.circuit.backstack.SaveableBackStack
98
import com.slack.circuit.backstack.rememberSaveableBackStack
109
import com.slack.circuit.codegen.annotations.CircuitInject
1110
import com.slack.circuit.foundation.rememberCircuitNavigator
@@ -27,7 +26,6 @@ class BottomNavigationPresenter @AssistedInject constructor(
2726
val delegateNavigator = remember(childNavigator, rootNavigator) {
2827
DelegateNavigator(childNavigator, rootNavigator)
2928
}
30-
3129
val currentTab = getCurrentTab(childBackStack)
3230

3331
fun handleEvent(event: BottomNavigationUiEvent) {
@@ -56,11 +54,3 @@ class BottomNavigationPresenter @AssistedInject constructor(
5654
fun create(rootNavigator: Navigator): BottomNavigationPresenter
5755
}
5856
}
59-
60-
@Composable
61-
private fun getCurrentTab(backStack: SaveableBackStack): MainTab? {
62-
val currentScreen = backStack.topRecord?.screen
63-
return currentScreen?.let { screen ->
64-
MainTab.entries.find { it.screen::class == currentScreen::class }
65-
}
66-
}

0 commit comments

Comments
 (0)