Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -470,15 +470,7 @@ class MapboxNavigation @VisibleForTesting internal constructor(
tilesVersion = navigationOptions.routingTilesOptions.tilesVersion
),
navigationOptions.accessToken ?: "",
if (moduleRouter.isInternalImplementation()) {
// We pass null to let NN know that default router is used and it can rely
// on implementation details in some cases like offline-online switch.
// Meanwhile platform SDK uses its own instance of native router for
// route requests
null
} else {
RouterInterfaceAdapter(moduleRouter, ::getNavigationRoutes)
},
getRouterInterfaceForNativeNavigator()
)
etcGateAPI = EtcGateApi(navigator.experimental)

Expand Down Expand Up @@ -620,6 +612,18 @@ class MapboxNavigation @VisibleForTesting internal constructor(
roadObjectMatcher = RoadObjectMatcher(navigator)
}

private fun getRouterInterfaceForNativeNavigator(): RouterInterface? {
return if (moduleRouter.isInternalImplementation()) {
// We pass null to let NN know that default router is used and it can rely
// on implementation details in some cases like offline-online switch.
// Meanwhile platform SDK uses its own instance of native router for
// route requests
null
} else {
RouterInterfaceAdapter(moduleRouter, ::getNavigationRoutes)
}
}

/**
* Control the location events playback during a replay trip session.
* Start a replay trip session with [startReplayTripSession].
Expand Down Expand Up @@ -2033,11 +2037,7 @@ class MapboxNavigation @VisibleForTesting internal constructor(
historyRecorderHandles.composite,
createTilesConfig(isFallback, tilesVersion),
navigationOptions.accessToken ?: "",
if (moduleRouter.isInternalImplementation()) {
nativeRouter
} else {
RouterInterfaceAdapter(moduleRouter, ::getNavigationRoutes)
},
getRouterInterfaceForNativeNavigator()
)
etcGateAPI.experimental = navigator.experimental
assignHistoryRecorders()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ interface MapboxNativeNavigator {
historyRecorderComposite: HistoryRecorderHandle?,
tilesConfig: TilesConfig,
accessToken: String,
router: RouterInterface,
router: RouterInterface?,
)

suspend fun resetRideSession()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ object MapboxNativeNavigatorImpl : MapboxNativeNavigator {
historyRecorderComposite: HistoryRecorderHandle?,
tilesConfig: TilesConfig,
accessToken: String,
router: RouterInterface
router: RouterInterface?
) {
val storeNavSessionState = navigator!!.storeNavigationSession()
create(config, historyRecorderComposite, tilesConfig, accessToken, router)
Expand Down