@@ -470,15 +470,7 @@ class MapboxNavigation @VisibleForTesting internal constructor(
470
470
tilesVersion = navigationOptions.routingTilesOptions.tilesVersion
471
471
),
472
472
navigationOptions.accessToken ? : " " ,
473
- if (moduleRouter.isInternalImplementation()) {
474
- // We pass null to let NN know that default router is used and it can rely
475
- // on implementation details in some cases like offline-online switch.
476
- // Meanwhile platform SDK uses its own instance of native router for
477
- // route requests
478
- null
479
- } else {
480
- RouterInterfaceAdapter (moduleRouter, ::getNavigationRoutes)
481
- },
473
+ getRouterInterfaceForNativeNavigator()
482
474
)
483
475
etcGateAPI = EtcGateApi (navigator.experimental)
484
476
@@ -620,6 +612,18 @@ class MapboxNavigation @VisibleForTesting internal constructor(
620
612
roadObjectMatcher = RoadObjectMatcher (navigator)
621
613
}
622
614
615
+ private fun getRouterInterfaceForNativeNavigator (): RouterInterface ? {
616
+ return if (moduleRouter.isInternalImplementation()) {
617
+ // We pass null to let NN know that default router is used and it can rely
618
+ // on implementation details in some cases like offline-online switch.
619
+ // Meanwhile platform SDK uses its own instance of native router for
620
+ // route requests
621
+ null
622
+ } else {
623
+ RouterInterfaceAdapter (moduleRouter, ::getNavigationRoutes)
624
+ }
625
+ }
626
+
623
627
/* *
624
628
* Control the location events playback during a replay trip session.
625
629
* Start a replay trip session with [startReplayTripSession].
@@ -2033,11 +2037,7 @@ class MapboxNavigation @VisibleForTesting internal constructor(
2033
2037
historyRecorderHandles.composite,
2034
2038
createTilesConfig(isFallback, tilesVersion),
2035
2039
navigationOptions.accessToken ? : " " ,
2036
- if (moduleRouter.isInternalImplementation()) {
2037
- nativeRouter
2038
- } else {
2039
- RouterInterfaceAdapter (moduleRouter, ::getNavigationRoutes)
2040
- },
2040
+ getRouterInterfaceForNativeNavigator()
2041
2041
)
2042
2042
etcGateAPI.experimental = navigator.experimental
2043
2043
assignHistoryRecorders()
0 commit comments