Skip to content

Commit 01ce38b

Browse files
kikin81claude
andcommitted
fix(runtime): add missing buildRouteName utility function
Adds the buildRouteName() utility function that was referenced by generated code but was missing from the runtime library. This function creates unique route names for the Compose Navigation library by combining the entry's qualified class name with a hash of its arguments (if present). Fixes compilation errors in generated entry factory code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 52c98e2 commit 01ce38b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package nibel.runtime
2+
3+
import android.os.Parcelable
4+
5+
/**
6+
* Builds a unique route name for navigation based on the entry class name and arguments.
7+
*
8+
* The route name is used by the Compose Navigation library to identify destinations.
9+
* For entries with arguments, the route includes a hash of the arguments to ensure uniqueness.
10+
* For entries without arguments, only the qualified name is used.
11+
*
12+
* @param qualifiedName The fully qualified class name of the entry
13+
* @param args The arguments for the entry, or null if no arguments
14+
* @return A unique route string for navigation
15+
*/
16+
fun buildRouteName(qualifiedName: String, args: Parcelable?): String {
17+
return if (args != null) {
18+
"$qualifiedName@${args.hashCode()}"
19+
} else {
20+
qualifiedName
21+
}
22+
}

0 commit comments

Comments
 (0)