From 1dff601909bb0dcb6d70452b499263a44eac8ed8 Mon Sep 17 00:00:00 2001 From: Isaac Udy Date: Sun, 24 May 2026 01:40:28 +1200 Subject: [PATCH 1/2] Add isDebug parameter to installNavigationController Replaces the hardcoded `internal val isDebug = false` (with its `// TODO NEED TO CONFIGURE THIS` placeholder) with a real config knob. isDebug is now a parameter on the generated installNavigationController and rememberNavigationController extensions, plumbed through internalCreateEnroController to set the flag on the EnroController before any module is added. Default is false to preserve existing behaviour. Apps wire it to BuildConfig.DEBUG (or the platform equivalent): MyComponent.installNavigationController(this, isDebug = BuildConfig.DEBUG) Co-Authored-By: Claude Opus 4.7 (1M context) --- .../generator/NavigationComponentGenerator.kt | 11 +++++++++-- .../src/commonMain/kotlin/dev/enro/EnroController.kt | 5 +++-- .../enro/controller/internalCreateEnroController.kt | 2 ++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/enro-processor/src/main/java/dev/enro/processor/generator/NavigationComponentGenerator.kt b/enro-processor/src/main/java/dev/enro/processor/generator/NavigationComponentGenerator.kt index 83aca96ce..9c4287763 100644 --- a/enro-processor/src/main/java/dev/enro/processor/generator/NavigationComponentGenerator.kt +++ b/enro-processor/src/main/java/dev/enro/processor/generator/NavigationComponentGenerator.kt @@ -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", @@ -103,10 +108,11 @@ object NavigationComponentGenerator { .addCode( """ val controller = internalCreateEnroController( + isDebug = isDebug, builder = { - ${generatedComponent.name}().apply { + ${generatedComponent.name}().apply { module(module) - invoke() + invoke() } block() } @@ -148,6 +154,7 @@ object NavigationComponentGenerator { return androidx.compose.runtime.remember { installNavigationController( $platformParameterName = Unit, + isDebug = isDebug, block = block, ) } diff --git a/enro-runtime/src/commonMain/kotlin/dev/enro/EnroController.kt b/enro-runtime/src/commonMain/kotlin/dev/enro/EnroController.kt index 949435ec5..cf9f5bc97 100644 --- a/enro-runtime/src/commonMain/kotlin/dev/enro/EnroController.kt +++ b/enro-runtime/src/commonMain/kotlin/dev/enro/EnroController.kt @@ -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) diff --git a/enro-runtime/src/commonMain/kotlin/dev/enro/controller/internalCreateEnroController.kt b/enro-runtime/src/commonMain/kotlin/dev/enro/controller/internalCreateEnroController.kt index f200148e9..81efa0587 100644 --- a/enro-runtime/src/commonMain/kotlin/dev/enro/controller/internalCreateEnroController.kt +++ b/enro-runtime/src/commonMain/kotlin/dev/enro/controller/internalCreateEnroController.kt @@ -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) From 992a38b76972b108606a65e4c4f6d6c1ddb7230e Mon Sep 17 00:00:00 2001 From: Isaac Udy Date: Sun, 24 May 2026 01:40:34 +1200 Subject: [PATCH 2/2] Real deprecation message for NavigationContainerState.Render MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the placeholder "TODO BETTER DEPRECATION MESSAGE" with a proper message + ReplaceWith pointing at NavigationDisplay(this) — which is what Render delegates to internally. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../kotlin/dev/enro/ui/NavigationContainerState.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/enro-runtime/src/commonMain/kotlin/dev/enro/ui/NavigationContainerState.kt b/enro-runtime/src/commonMain/kotlin/dev/enro/ui/NavigationContainerState.kt index 29f86fb37..763892a73 100644 --- a/enro-runtime/src/commonMain/kotlin/dev/enro/ui/NavigationContainerState.kt +++ b/enro-runtime/src/commonMain/kotlin/dev/enro/ui/NavigationContainerState.kt @@ -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)