Skip to content
Merged
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 @@ -76,6 +76,11 @@ object NavigationComponentGenerator {
.addModifiers(KModifier.PUBLIC)
.returns(ClassNames.Kotlin.navigationController)
.addPlatformParameter()
.addParameter(
ParameterSpec.builder("isDebug", Boolean::class)
.defaultValue("false")
.build()
)
.addParameter(
ParameterSpec.builder(
"block",
Expand Down Expand Up @@ -103,10 +108,11 @@ object NavigationComponentGenerator {
.addCode(
"""
val controller = internalCreateEnroController(
isDebug = isDebug,
builder = {
${generatedComponent.name}().apply {
${generatedComponent.name}().apply {
module(module)
invoke()
invoke()
}
block()
}
Expand Down Expand Up @@ -148,6 +154,7 @@ object NavigationComponentGenerator {
return androidx.compose.runtime.remember {
installNavigationController(
$platformParameterName = Unit,
isDebug = isDebug,
block = block,
)
}
Expand Down
5 changes: 3 additions & 2 deletions enro-runtime/src/commonMain/kotlin/dev/enro/EnroController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import kotlinx.serialization.json.Json

@Stable
public class EnroController {
// TODO NEED TO CONFIGURE THIS
internal val isDebug = false
// Set during construction by internalCreateEnroController, plumbed through
// from the isDebug parameter on the generated installNavigationController.
internal var isDebug: Boolean = false
internal var platformReference: Any? = null
internal val plugins = PluginRepository()
internal val bindings = BindingRepository(plugins)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import dev.enro.platform.platformNavigationModule

// Marked as internal, but is used in generated code with a @Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
internal fun internalCreateEnroController(
isDebug: Boolean = false,
builder: NavigationModule.BuilderScope.() -> Unit = {},
) : EnroController {
val module = createNavigationModule(builder)
return EnroController().apply {
this.isDebug = isDebug
addModule(defaultNavigationModule)
addModule(platformNavigationModule)
addModule(module)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,14 @@ public class NavigationContainerState(
container.setBackstackDirect(restoredBackstack.asBackstack())
}

@Deprecated("TODO BETTER DEPRECATION MESSAGE")
@Deprecated(
message = "Use NavigationDisplay(state) instead. This method only exists for migration ergonomics and will be removed before 3.0 stable.",
replaceWith = ReplaceWith(
expression = "NavigationDisplay(this)",
imports = ["dev.enro.ui.NavigationDisplay"],
),
level = DeprecationLevel.WARNING,
)
@Composable
public fun Render() {
NavigationDisplay(this)
Expand Down
Loading