MainMenuViewModel

class MainMenuViewModel(val appState: AppStateImpl, val globalError: ReversiException? = null, val setGlobalError: (Exception?, ErrorType?) -> Unit, val setPage: (Page) -> Unit) : ViewModel<MainMenuUIState>

ViewModel for the main menu screen. Manages menu interactions, audio playback, and navigation state.

Constructors

Link copied to clipboard
constructor(appState: AppStateImpl, globalError: ReversiException? = null, setGlobalError: (Exception?, ErrorType?) -> Unit, setPage: (Page) -> Unit)

Properties

Link copied to clipboard
protected open override val _uiState: MutableState<MainMenuUIState>

The mutable internal UI state.

Link copied to clipboard
private val appState: AppStateImpl

The global application state.

Link copied to clipboard
open override val globalError: ReversiException?

The current global error, if any.

Link copied to clipboard
open override val setGlobalError: (Exception?, ErrorType?) -> Unit

A callback function to update the global error state.

Link copied to clipboard
val setPage: (Page) -> Unit

Functions

Link copied to clipboard

Plays the background menu music from the current theme if not already playing. Stops all other audio before starting the background music.