package com.suno.android.ui.screens.home.tabs import androidx.annotation.MainThread import com.suno.android.common_core_utils.thread.assertMainThread import com.suno.android.ui.screens.navigation.NavDestination import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import javax.inject.Inject import javax.inject.Singleton /** * Tracks the current tab state for the bottom navigation bar. */ interface BottomTabBarManager { val currentTab: Flow @MainThread fun getCurrentTab(): NavDestination? @MainThread fun setCurrentTab( destination: NavDestination, ) } @Singleton class DefaultBottomTabBarManager @Inject constructor() : BottomTabBarManager { private val _currentTab = MutableStateFlow(null) override val currentTab = _currentTab.asStateFlow() override fun getCurrentTab(): NavDestination? { assertMainThread() return _currentTab.value } override fun setCurrentTab( destination: NavDestination, ) { assertMainThread() _currentTab.value = destination } }