NavigationDashboardViewModel

ViewModel interface for managing the navigation dashboard state and user interactions.

Responsible for:

  • Managing free roam mode state

  • Handling audio mode settings for navigation instructions

  • Tracking remaining route information (distance and time)

  • Managing show route and finish navigation handlers

Thread Safety

This ViewModel is not thread-safe and must only be accessed from the Main thread.

  • All methods must be called from the Main (UI) thread

  • All StateFlow properties emit values on the Main thread

  • Concurrent access from multiple threads may lead to undefined behavior

Inheritors

Properties

Link copied to clipboard
abstract val audioMode: StateFlow<NavigationDashboardAudioMode>

Observable state of audio navigation instructions. Indicates whether audio is on, off, or unavailable for the current route.

Link copied to clipboard
abstract val dashboardInfo: StateFlow<NavigationDashboardInfo?>

Observable state containing navigation dashboard information. Can be RemainingInfo with route details or IndoorInfo with floor/organization data. Null when navigation information is unavailable.

Link copied to clipboard
abstract val finishHandler: StateFlow<() -> Unit?>

Observable handler for finishing the navigation session. This handler is invoked when the user chooses to end navigation.

Link copied to clipboard
abstract val isFreeRoam: StateFlow<Boolean>

Observable state indicating whether navigation is in free roam mode. In free roam mode, the user follows a route without turn-by-turn navigation guidance.

Link copied to clipboard
abstract val isMinimapVisible: StateFlow<Boolean>

Observable state of indicates whether minimap is visible during navigation.

Link copied to clipboard
abstract val showRouteHandler: StateFlow<() -> Unit?>

Observable handler for showing the route on the map. This handler is invoked when the user taps the "Show Route" button. Only available when not in free roam mode.

Link copied to clipboard
abstract val toggleMinimapVisibilityHandler: StateFlow<(Boolean) -> Unit?>

Observable handler for showing the minimap during navigation.

Functions

Link copied to clipboard
abstract fun onAudioButtonClicked()

Handles audio button clicks to toggle navigation voice instructions. Toggles between On and Off states when audio is available.

Link copied to clipboard
abstract fun onCleared()

Releases resources when the view model is no longer needed.

Link copied to clipboard
abstract fun setFinishHandler(handler: () -> Unit?)

Sets the handler to be invoked when the user chooses to finish navigation.

Link copied to clipboard
abstract fun setShowRouteHandler(handler: () -> Unit?)

Sets the handler to be invoked when the user taps the "Show Route" button. The handler will only be active when not in free roam mode.

Link copied to clipboard
abstract fun setToggleMinimapVisibilityHandler(handler: (Boolean) -> Unit?)

Handles minimap button clicks to toggle its visibility during navigation.