DefaultNavigationDashboardViewModel

class DefaultNavigationDashboardViewModel(navigationManager: NavigationManager, isFreeRoamDefault: Boolean) : NavigationDashboardViewModel

Default implementation of DashboardViewModel that manages the navigation dashboard state.

This ViewModel:

  • Manages free roam mode state

  • Handles audio mode settings for navigation instructions

  • Tracks remaining route information (distance and time)

  • Provides indoor navigation information (floor and organization)

  • Manages show route and finish navigation handlers

Important: Call onCleared when this ViewModel is no longer needed to properly release resources, clear handlers, and close all connections to prevent memory leaks.

Parameters

navigationManager

Provides navigation state and route information updates.

isFreeRoamDefault

Default state for free roam mode when navigation is disabled.

Constructors

Link copied to clipboard
constructor(navigationManager: NavigationManager, isFreeRoamDefault: Boolean)

Properties

Link copied to clipboard
open override 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
open override 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
open override 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
open override 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
open override val isMinimapVisible: StateFlow<Boolean>

Observable state of indicates whether minimap is visible during navigation.

Link copied to clipboard
open override 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
open override val toggleMinimapVisibilityHandler: StateFlow<(Boolean) -> Unit?>

Observable handler for showing the minimap during navigation.

Functions

Link copied to clipboard
open override 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
open override fun onCleared()

Releases resources when the view model is no longer needed.

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

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

Link copied to clipboard
open override 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
open override fun setToggleMinimapVisibilityHandler(handler: (Boolean) -> Unit?)

Handles minimap button clicks to toggle its visibility during navigation.