diff --git a/app/src/main/java/com/surrus/peopleinspace/ui/MainActivity.kt b/app/src/main/java/com/surrus/peopleinspace/ui/MainActivity.kt index f0a3bad..07331f6 100644 --- a/app/src/main/java/com/surrus/peopleinspace/ui/MainActivity.kt +++ b/app/src/main/java/com/surrus/peopleinspace/ui/MainActivity.kt @@ -24,6 +24,7 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.core.os.bundleOf +import androidx.navigation.NavController import androidx.navigation.compose.* import androidx.ui.tooling.preview.Preview import androidx.ui.tooling.preview.PreviewParameter @@ -59,12 +60,12 @@ fun MainLayout(peopleInSpaceViewModel: PeopleInSpaceViewModel) { composable(Screen.PersonListScreen.title) { PersonList(peopleInSpaceViewModel = peopleInSpaceViewModel, personSelected = { - navController.navigate(Screen.PersonDetailsDetails.title, bundleOf("person" to it.name)) + navController.navigate(Screen.PersonDetailsDetails.title + "/${it.name}") } ) } - composable(Screen.PersonDetailsDetails.title) { backStackEntry -> - PersonDetailsView(peopleInSpaceViewModel, backStackEntry.arguments?.get("person") as String) + composable(Screen.PersonDetailsDetails.title + "/{person}") { backStackEntry -> + PersonDetailsView(navController, peopleInSpaceViewModel, backStackEntry.arguments?.get("person") as String) } } } @@ -111,8 +112,7 @@ fun PersonView(personImageUrl: String, person: Assignment, personSelected : (per } @Composable -fun PersonDetailsView(peopleInSpaceViewModel: PeopleInSpaceViewModel, personName: String) { - val navController = AmbientNavController.current +fun PersonDetailsView(navController: NavController, peopleInSpaceViewModel: PeopleInSpaceViewModel, personName: String) { Scaffold( topBar = { TopAppBar( diff --git a/build.gradle b/build.gradle index a3fb6e6..e1d30c7 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,6 @@ allprojects { maven { url = "https://dl.bintray.com/ekito/koin" } maven { url = "https://kotlin.bintray.com/kotlin-js-wrappers/" } maven { url = "https://jitpack.io" } - maven { url = "https://androidx.dev/snapshots/builds/6910220/artifacts/repository" } } } diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index 14c6934..a6c7f11 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -9,7 +9,8 @@ object Versions { const val sqliteJdbcDriver = "3.30.1" const val slf4j = "1.7.30" - const val compose = "1.0.0-alpha05" + const val compose = "1.0.0-alpha06" + const val nav_compose_version = "1.0.0-alpha01" const val coilVersion = "0.3.1" const val junit = "4.13" @@ -34,7 +35,7 @@ object Compose { const val foundationLayout = "androidx.compose.foundation:foundation-layout:${Versions.compose}" const val material = "androidx.compose.material:material:${Versions.compose}" const val runtimeLiveData = "androidx.compose.runtime:runtime-livedata:${Versions.compose}" - const val navigation = "androidx.navigation:navigation-compose:1.0.0-SNAPSHOT" + const val navigation = "androidx.navigation:navigation-compose:${Versions.nav_compose_version}" const val accompanist= "dev.chrisbanes.accompanist:accompanist-coil:${Versions.coilVersion}" }