Skip to content

Commit

Permalink
Merge branch 'compose-1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
raamcosta committed Nov 1, 2022
2 parents df4a0ae + e87d5b0 commit 0d662f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,6 +32,7 @@ import com.ramcosta.composedestinations.spec.DestinationStyle
* }
* ```
*/
@OptIn(InternalDestinationsApi::class)
@ExperimentalAnimationApi
fun <T> NavGraphBuilder.animatedComposable(
destination: DestinationSpec<T>,
Expand Down Expand Up @@ -79,11 +81,15 @@ fun <T> 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!")
}
}
}
Expand Down Expand Up @@ -128,10 +134,10 @@ fun <T> 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!")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ interface ActivityDestinationSpec<T> : DestinationSpec<T> {
error("unexpected error: calling SavedStateHandle based argsFrom method on ActivityDestination!")

@Composable
override fun DestinationScope<T>.Content(dependenciesContainerBuilder: DependenciesContainerBuilder<T>.() -> Unit) {
override fun DestinationScope<T>.Content(dependenciesContainerBuilder: @Composable DependenciesContainerBuilder<T>.() -> Unit) {
error("unexpected error: calling Content method ActivityDestination!")
}
// endregion
Expand Down

0 comments on commit 0d662f8

Please sign in to comment.