From d1cc239d8330365466165409702350e4f51cece2 Mon Sep 17 00:00:00 2001 From: Jay Ohms Date: Wed, 16 Nov 2022 07:43:27 -0500 Subject: [PATCH] Use a random UUID instead of an Int --- .../kotlin/dev/hotwire/turbo/nav/TurboNavGraphBuilder.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/turbo/src/main/kotlin/dev/hotwire/turbo/nav/TurboNavGraphBuilder.kt b/turbo/src/main/kotlin/dev/hotwire/turbo/nav/TurboNavGraphBuilder.kt index cfd51c5e..5c733119 100644 --- a/turbo/src/main/kotlin/dev/hotwire/turbo/nav/TurboNavGraphBuilder.kt +++ b/turbo/src/main/kotlin/dev/hotwire/turbo/nav/TurboNavGraphBuilder.kt @@ -12,7 +12,7 @@ import androidx.navigation.fragment.FragmentNavigator import androidx.navigation.fragment.FragmentNavigatorDestinationBuilder import dev.hotwire.turbo.config.TurboPathConfiguration import dev.hotwire.turbo.config.uri -import kotlin.random.Random +import java.util.* import kotlin.reflect.KClass import kotlin.reflect.full.findAnnotation import kotlin.reflect.full.isSubclassOf @@ -93,13 +93,13 @@ internal class TurboNavGraphBuilder( defaultValue = startLocation } - // Use a random number to represent a unique instance of the graph, so the + // Use a random value to represent a unique instance of the graph, so the // graph is unique every time. This lets it be reset/recreated on-demand from // `TurboSessionNavHostFragment.reset()`. Replacing an existing nav graph with // an identical one would bypass recreating the nav stack from scratch in // `NavController.setGraph()`. argument("unique_instance") { - defaultValue = Random.nextInt() + defaultValue = UUID.randomUUID().toString() } } }