Skip to content

Commit

Permalink
Move view model to AppModule to better reflect a typical DI use case
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthetechie committed Nov 11, 2024
1 parent 1d8d8db commit df63897
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,6 @@ object AppModule {

// The AndroidTtsObserver handles spoken instructions as they are triggered by FerrostarCore.
val ttsObserver: AndroidTtsObserver by lazy { AndroidTtsObserver(appContext) }

val viewModel: DemoNavigationViewModel by lazy { DemoNavigationViewModel() }
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ import uniffi.ferrostar.WaypointKind
fun DemoNavigationScene(
savedInstanceState: Bundle?,
locationProvider: LocationProvider = AppModule.locationProvider,
viewModel: DemoNavigationViewModel = AppModule.viewModel
) {
// Keeps the screen on at consistent brightness while this Composable is in the view hierarchy.
KeepScreenOnDisposableEffect()

val viewModel = remember { DemoNavigationViewModel() }
val scope = rememberCoroutineScope()

// Get location permissions.
Expand Down

0 comments on commit df63897

Please sign in to comment.