From 91f073246cd03d97c50cfa63a9ed7c5373e57768 Mon Sep 17 00:00:00 2001 From: Rafael Costa Date: Thu, 16 May 2024 14:21:31 +0100 Subject: [PATCH] Fixes #636 --- .../codegen/writers/sub/SingleNavGraphWriter.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/compose-destinations-codegen/src/main/java/com/ramcosta/composedestinations/codegen/writers/sub/SingleNavGraphWriter.kt b/compose-destinations-codegen/src/main/java/com/ramcosta/composedestinations/codegen/writers/sub/SingleNavGraphWriter.kt index a12f8e13..595b79aa 100644 --- a/compose-destinations-codegen/src/main/java/com/ramcosta/composedestinations/codegen/writers/sub/SingleNavGraphWriter.kt +++ b/compose-destinations-codegen/src/main/java/com/ramcosta/composedestinations/codegen/writers/sub/SingleNavGraphWriter.kt @@ -83,7 +83,19 @@ internal class SingleNavGraphWriter( .replace(NAV_GRAPH_DEEP_LINKS_PLACEHOLDER, navGraph.deepLinksCode()) .replace(INNER_IMPORTED_ROUTES, navGraph.innerExternalRoutes()) .replace(NAV_GRAPH_GEN_NAV_ARGS, navGraph.generatedNavArgsClass()) - .replace(NAV_GRAPH_VISIBILITY_PLACEHOLDER, navGraph.visibility.name.lowercase()) + .replace( + NAV_GRAPH_VISIBILITY_PLACEHOLDER, + navGraph.visibility.let { + when (it) { + Visibility.PUBLIC -> """ + @${importableHelper.addAndGetPlaceholder(Importable("Keep", "androidx.annotation.Keep"))} + ${it.name.lowercase()} + """.trimIndent() + Visibility.INTERNAL, + Visibility.PRIVATE -> it.name.lowercase() + } + } + ) .replace( NAV_GRAPH_TYPE, navGraph.graphSuperType()