diff --git a/compose-destinations-animations/src/main/java/com/ramcosta/composedestinations/animations/utils/NavGraphBuilderDestinationExtensions.kt b/compose-destinations-animations/src/main/java/com/ramcosta/composedestinations/animations/utils/NavGraphBuilderDestinationExtensions.kt index 9b1acf67..5d1cb3cf 100644 --- a/compose-destinations-animations/src/main/java/com/ramcosta/composedestinations/animations/utils/NavGraphBuilderDestinationExtensions.kt +++ b/compose-destinations-animations/src/main/java/com/ramcosta/composedestinations/animations/utils/NavGraphBuilderDestinationExtensions.kt @@ -9,6 +9,7 @@ import com.google.accompanist.navigation.material.ExperimentalMaterialNavigation import com.google.accompanist.navigation.material.bottomSheet import com.ramcosta.composedestinations.animations.scope.AnimatedNavGraphBuilderDestinationScopeImpl import com.ramcosta.composedestinations.animations.scope.BottomSheetNavGraphBuilderDestinationScopeImpl +import com.ramcosta.composedestinations.annotation.InternalDestinationsApi import com.ramcosta.composedestinations.scope.AnimatedNavGraphBuilderDestinationScope import com.ramcosta.composedestinations.scope.BottomSheetNavGraphBuilderDestinationScope import com.ramcosta.composedestinations.spec.DestinationSpec @@ -31,6 +32,7 @@ import com.ramcosta.composedestinations.spec.DestinationStyle * } * ``` */ +@OptIn(InternalDestinationsApi::class) @ExperimentalAnimationApi fun NavGraphBuilder.animatedComposable( destination: DestinationSpec, @@ -79,11 +81,15 @@ fun NavGraphBuilder.animatedComposable( } is DestinationStyle.BottomSheet -> { - throw RuntimeException("You need to use `bottomSheetComposable` for Bottom Sheet destinations!") + throw IllegalArgumentException("You need to use `bottomSheetComposable` for Bottom Sheet destinations!") } is DestinationStyle.Dialog -> { - throw RuntimeException("You need to use `dialogComposable` for Dialog destinations!") + throw IllegalArgumentException("You need to use `dialogComposable` for Dialog destinations!") + } + + is DestinationStyle.Activity -> { + throw IllegalArgumentException("You need to use `activity` for Activity destinations!") } } } @@ -128,10 +134,10 @@ fun NavGraphBuilder.bottomSheetComposable( } } is DestinationStyle.Dialog -> { - throw RuntimeException("You need to use `dialogComposable` for Dialog destinations!") + throw IllegalArgumentException("You need to use `dialogComposable` for Dialog destinations!") } else -> { - throw RuntimeException("You need to use `animatedComposable` for Animated or Default styled destinations!") + throw IllegalArgumentException("You need to use `animatedComposable` for Animated or Default styled destinations!") } } } \ No newline at end of file diff --git a/compose-destinations/src/main/java/com/ramcosta/composedestinations/spec/ActivityDestinationSpec.kt b/compose-destinations/src/main/java/com/ramcosta/composedestinations/spec/ActivityDestinationSpec.kt index eec8ddc9..81ad0ea3 100644 --- a/compose-destinations/src/main/java/com/ramcosta/composedestinations/spec/ActivityDestinationSpec.kt +++ b/compose-destinations/src/main/java/com/ramcosta/composedestinations/spec/ActivityDestinationSpec.kt @@ -58,7 +58,7 @@ interface ActivityDestinationSpec : DestinationSpec { error("unexpected error: calling SavedStateHandle based argsFrom method on ActivityDestination!") @Composable - override fun DestinationScope.Content(dependenciesContainerBuilder: DependenciesContainerBuilder.() -> Unit) { + override fun DestinationScope.Content(dependenciesContainerBuilder: @Composable DependenciesContainerBuilder.() -> Unit) { error("unexpected error: calling Content method ActivityDestination!") } // endregion