Small code generating library for safe Jetpack Compose navigation with no boilerplate.

Overview

Maven Central

Compose Destinations

A KSP library to use alongside compose navigation. It reduces boilerplate code and is less error-prone since passing arguments between screens is type-safe. You won't need to update multiple source files every time you add or remove a screen composable, the navigation graph will be updated automatically.

Table of contents

Usage

  1. Start by annotating the Composable functions that you want to add to the navigation graph with @Destination.
@Destination(route = "home", start = true)
@Composable
fun HomeScreen(
    navController: NavController
) {
	//...
}

NOTE: You can use DestinationsNavigator instead of NavController to make these Composables testable and "previewable". Read more in Going deeper

  1. Build the project (f.e: Build > Make Project) to make KSP generate HomeScreenDestination and Destinations files. Each @Destination will generate a Destination object, so do this everytime you need to access new Destination files.

  2. Replace your NavHost call with Destinations.NavHost (or if using a Scaffold, then replace it with Destinations.Scaffold). You can also remove the builder blocks, you won't be needing them anymore.

Destinations.NavHost(
    navController = myNavController
)

OR

Destinations.Scaffold(
    scaffoldState = myScaffoldState
)
  1. If the destination has arguments, then simply add them to the Composable function!
@Destination(route = "user")
@Composable
fun UserScreen(
    userId: Long
)
  1. Then, to navigate to the User Screen, anywhere you have the NavController (or DestinationsNavigator).
navController.navigate(UserScreenDestination.withArgs(userId = 1))

That's it! No messing with NavType, weird routes, bundles and strings. All this will be taken care for you.

  1. Oh and by the way, what if the destination has default arguments? Wouldn't it be nice if we could just use Kotlin default parameters feature? Well, that is exactly how we do it:
@Destination(route = "user")
@Composable
fun UserScreen(
    userId: Long,
    isOwnUser: Boolean = false
)

Now the IDE will even tell you the default arguments of the composable when calling the withArgs method!

Notes about arguments:

  • They must be one of String, Boolean, Int, Float, Long to be considered navigation arguments. NavController, DestinationsNavigator, NavBackStackEntry or ScaffoldState (only if you are using Scaffold) can also be used by all destinations.
  • Navigation arguments' default values must be resolvable from the generated Destination class since the code written after the "=" will be copied into it as is. Unfortunately, this means you won't be able to use a constant or a function call as the default value of a nav argument. However, if the parameter type is not a navigation argument type, then everything is valid since it won't be considered a navigation argument of the destination. For example:
@Destination(route = "greeting", start = true)
@Composable
fun Greeting(
    navigator: DestinationsNavigator,
    coroutineScope: CoroutineScope = rememberCoroutineScope() //valid because CoroutineScope is not a navigation argument type
)

@Destination(route = "user")
@Composable
fun UserScreen(
    navigator: DestinationsNavigator,
    id: Int = getDefaultUserId() //not valid because Int is a navigation argument type so we need to resolve the default value in the generated classes
)

//As a temporary workaround, you could define the argument as nullable (or lets say -1)
@Destination(route = "user")
@Composable
fun UserScreen(
  navigator: DestinationsNavigator,
  id: Int? = null
) {
  //then here do:
  val actualId = id ?: getDefaultUserId()
}

We'll be looking for ways to improve this.

Deep Links

You can define deeps links to a destination like this:

@Destination(
  route = "user",
  deepLinks = [
    DeepLink(
      uriPattern = "https://myapp.com/user/{id}"
    )
  ]
)
@Composable
fun UserScreen(
  navigator: DestinationsNavigator,
  id: Int
)

You can also use the placeholder suffix FULL_ROUTE_PLACEHOLDER in your uriPattern. In the code generation process it will be replaced with the full route of the destination which contains all the destination arguments. So, for example, this would result in the same uriPattern as the above example:

@Destination(
  route = "user",
  deepLinks = [
    DeepLink(
      uriPattern = "https://myapp.com/$FULL_ROUTE_PLACEHOLDER"
    )
  ]
)
@Composable
fun UserScreen(
  navigator: DestinationsNavigator,
  id: Int
)

Setup

Compose destinations is available via maven central.

  1. Add the ksp plugin:
plugins {
    //...
    id("com.google.devtools.ksp") version "1.5.21-1.0.0-beta07" // This will change to the stable ksp version when compose allows us to use kotlin 1.5.30
}
  1. Add the dependencies:
implementation 'io.github.raamcosta.compose-destinations:core:0.7.0-alpha04'
ksp 'io.github.raamcosta.compose-destinations:ksp:0.7.0-alpha04'
  1. And finally, you need to make sure the IDE looks at the generated folder. See KSP related issue. An example for the debug variant would be:
sourceSets {
    //...
    main {
        java.srcDir(file("build/generated/ksp/debug/kotlin"))
    }
}

Going deeper

  • It is good practice to not depend directly on NavController on your Composeables. You can choose to depend on DestinationsNavigator instead of NavController, which is an interface wrapper of NavController that allows to easily pass an empty implementation (one is available already EmptyDestinationsNavigator) for previews or testing. All above examples can replace navController: NavController with navigator: DestinationsNavigator, in order to make use of this dependency inversion principle.
  • All annotated composables will generate an implementation of Destination which is a sealed interface that contains the full route, navigation arguments, Content composable function and the withArgs implementation.
  • Destination annotation can receive a navGraph parameter for nested navigation graphs. This will be the route of the nested graph and all destinations with the same navGraph will belong to it. If this parameter is not specified, then the Destination will belong to the root navigation graph (which is the norm when not using nested nav graphs)
  • Scaffold composable lambda parameters will be given a current Destination. This makes it trivial to have top bar, bottom bar and drawer depend on the current destination.
  • Besides the NavHost and Scaffold wrappers, the generated Destinations class contains all NavGraphs. Each NavGraph contains the start Destination as well as all its destinations and its nested NavGraphs.
  • If you would like to have additional properties/functions in the Destination (for example a "title" which will be shown to the user for each screen) you can make an extension property/function of Destination for a similar effect. Since it is a sealed interface, a when expression will make sure you always have a definition for each screen (check this file for an example).

Current state

This lib is still in its alpha stage, APIs can change. I'm looking for all kinds of feedback, issues, feature requests and help in improving the code. So please, if you find this interesting, try it out in some sample projects and let me know how it goes!

License

Copyright 2021 Rafael Costa

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • Multi Module support

    Multi Module support

    I tried using the plugin with a multi module Android project, and D8 doesn't like the generation of classes.

    For example:

    I have module A and B, which are included in the app module. The app module has

    android{
    ...
        applicationVariants.all {
            sourceSets {
                getByName("main") {
                    java.srcDir(File("build/generated/ksp/$name/kotlin"))
                }
            }
        }
    ...
    }
    

    but D8 fails during compilation with the following error:

    * What went wrong:
    Execution failed for task ':app:mergeLibDexInternalDebug'.
    > A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingTaskDelegate
       > There was a failure while executing work items
          > A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingWorkAction
             > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
               Type com.ramcosta.composedestinations.AnimatedDestinationStyle$DefaultImpls is defined multiple times: <module1-path>\build\.transforms\7673bf153d1e0b34756cfeb713417353\transformed\classes\classes.dex, <module2-path>\build\.transforms\2692adfb593ffb4aebe8fa9a5adf48f0\transformed\classes\classes.dex
               Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
    

    Is it something I'm missing? Do you have a multi module example that I can follow? Thanks.

    enhancement 
    opened by mhaqs 71
  • Cannot switch NavGraphs route from inside a nested Destination

    Cannot switch NavGraphs route from inside a nested Destination

    I need help with figuring out how to navigate to a Destination that is in the route above current one/different route. The hierarchy looks somewhat like this

                root
                  |
       |------------------|
       |                main
       |                  |
    DialogDest        |-------|
                     Dest1  Dest2
    

    I need to navigate to DialogDest from Dest1, is that possible?

    question 
    opened by ghost 33
  • Using nested graph for a bottom bar destination recreates its VM on each display

    Using nested graph for a bottom bar destination recreates its VM on each display

    Hi there šŸ‘‹ This might be a mere misconception of mine but I wanted to pick your brain on this. Let's say you have a bottom bar with three destinations (for instance A, B, C). There are attached to the same nav graph (root to make things simpler). B is declared in a nested graph that is embedded in route so that some destination starting from B cannot be started from another screen.

    We would have something like this:

    DestinationsNavHost(/*...*/) {
        bottomBarGraph()
    }
    
    fun ManualComposableCallsBuilder.bottomBarGraph() {
        composable(ADestination) { A() }
        BGraph()
        composable(ADestination) { C() }
    }
    
    fun ManualComposableCallsBuilder.BGraph() {
        composable(BDestination) {
            BScreen(
                onClick = {
                    destinationsNavigator.navigate(DDestination)
                },
            )
        }
        D() // Launched only from B
    }
    

    As for the B composable and its declaration with its nav graph, we would have this:

    @BNavGraph(start = true)
    @Destination
    @Composable
    fun BScreen(
        viewModel: BVM = hiltViewModel()
    )
    
    @RootNavGraph
    @NavGraph
    annotation class BNavGraph(
        val start: Boolean = false
    )
    

    Observed: The B VM attached to the B composable is always recreated when navigated to the B destination from the bottom bar.

    Expected: The B VM should be scoped to the bottom bar graph (aka root) so that it doesn't get recreated, just like it's the case for A and C (that also have their own VM).

    I was under the impression that created a custom nested graph linked to the Root nav graph would make that link but that doesn't seem the case. Or maybe I'm misusing the nested graph in that specific case. My understanding is that nested graph allows me to split my navigation into smaller chunks for readability but also to make sure that some destinations stay scoped within a nav graph ā€“ especially if I'd modularize my app. Does this make sense to you? Btw I only use one NavHost šŸ™‚

    Thanks again for your great work and eager to get some feedback from you šŸ™

    question 
    opened by StephenVinouze 28
  • NavController#isRouteOnBackStack returns false

    NavController#isRouteOnBackStack returns false

    Hello. I tried to add bottom navigation to my project using your sample project as an example. But for a strange reason, NavController#isRouteOnBackStack returns false and this leads to an issue with the bottom navigation selected state and popping to the root screen when the bottom navigation tab is reselected. I researched this problem but checked everything and tried to change my code to 1:1 as in your sample. But your sample works, my project ā€” no.

    question 
    opened by TemMax 28
  • How to use popUpTo

    How to use popUpTo

     navController.navigate(destination) {
                    popUpTo("summary_screen") { inclusive = true }
               }
    
    navigator.navigate(destination)
    

    I am using above code to pop summary screen from backstack before navigating but its not working. Am i missing something?

    question wontfix 
    opened by knightsamir 27
  • Nested Graph, LoginScreen/authGraph, HomeScreen/,mainGraph

    Nested Graph, LoginScreen/authGraph, HomeScreen/,mainGraph

    Hi Rafael,

    I've created 2 navGraphs authGraph / mainGraph and i'm trying to implement the following

    AuthGraph includes LoginScreen MainGraph includes HomeScreen / other screens

    Sign in

    Login -> Home


    Sign out

    Home / other screens -> Login

    appreciate all the help!

    question 
    opened by ismai117 25
  • ViewModel unit test problems with SavedStateHandle.navArgs()

    ViewModel unit test problems with SavedStateHandle.navArgs()

    Hi,

    I'm using SavedStateHandle.navArgs() to get the navigation arguments on my ViewModel. However, on my Unit tests the call fails with NoClassDefFoundError: Could not initialize class error. I've added the value directly in my SavedStateHandle with no success.

    How can I manage to test the ViewModel with the navigation arguments without having to do a UI test?

    Could not initialize class com.ramcosta.composedestinations.navargs.primitives.DestinationsStringNavType
    java.lang.NoClassDefFoundError: Could not initialize class com.ramcosta.composedestinations.navargs.primitives.DestinationsStringNavType
    

    Code snippets:

    ViewModel

    class SearchViewModel @Inject constructor(
        savedStateHandle: SavedStateHandle,
        ...
    ) {
    
        init {
            // Test fails here
            val initialQuery = savedStateHandle.navArgs<SearchScreenNavArgs>().initialQuery
        }
    

    Unit test

    @Before
    fun setup() {
        viewModel = SearchViewModel(
                savedStateHandle = SavedStateHandle().apply {
                    set("initialQuery", "")
                },
                ...
        )
    }
    
    question 
    opened by luanbarbosa-sanoma 20
  • Support Array and ArrayList navigation arguments

    Support Array and ArrayList navigation arguments

    [ksp] com.ramcosta.composedestinations.codegen.commons.IllegalDestinationsSetup: Composable 'AmountScreen': 'navArgsDelegate' cannot have arguments that are not navigation types. at com.ramcosta.composedestinations.codegen.commons.DestinationWithNavArgsMapper.getNavArgs(DestinationWithNavArgsMapper.kt:24) at com.ramcosta.composedestinations.codegen.commons.DestinationWithNavArgsMapper.map(DestinationWithNavArgsMapper.kt:12) at com.ramcosta.composedestinations.codegen.CodeGenerator.generate(CodeGenerator.kt:26) at com.ramcosta.composedestinations.ksp.processors.Processor.process(Processor.kt:44) at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$4$1.invoke(KotlinSymbolProcessingExtension.kt:186) at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$4$1.invoke(KotlinSymbolProcessingExtension.kt:184) at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.handleException(KotlinSymbolProcessingExtension.kt:278) at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.doAnalysis(KotlinSymbolProcessingExtension.kt:184) at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:120) at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:86) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:252) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:243) at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:113) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:243) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:90) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:56) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:169) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:92) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98) at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1574) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359) at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)

    @Parcelize
    data class AmountScreenArgs(
        val sendingAmount: Float,
        val exchangeRate: Float,
        val purposeList: List<TransferPurpose>
    ):Parcelable
    
    
    @Parcelize
    data class TransferPurpose(
        val id: Int,
        val purpose: String,
        var is_selected:Boolean = false
    ): Parcelable
    
    
    @ExperimentalMaterialApi
    @ExperimentalCoilApi
    @ExperimentalAnimationApi
    @Composable
    @Destination(navArgsDelegate = AmountScreenArgs::class)
    fun AmountScreen(
        navigator: DestinationsNavigator,
        navController: NavController
    ) {
    }
    
    enhancement 
    opened by knightsamir 19
  • Hi

    Hi

    Hi How can I pass lamda as a callback function to the destination?

    ` @RootNavGraph(start = true) @Destination @Composable fun NavigationScreen( navigator: DestinationsNavigator ) {

    navigator.navigate(AuthScreenDestination(
        //############################
        //here I want to pass the lamda as a callback function
        nav = {screen ->
    
            when{
                screen is ScreenRout.HOMESCREEN ->
                    val userName = (screen as ScreenRout.HOMESCREEN).userName 
                    navigator.navigate(HomeScreenDestination(userName)))
            }
    
        }
    

    }

    @Destination @Composable fun AuthScreen( viewModel: LoginViewModel = hiltViewModel(), nav:(ScreenRout)->Unit ) { Button(onClick = { nav(ScreenRout.HOMESCREEN(username)) }) { Text(text = "Test Login") } }

    @Destination @Composable fun HomeScreen( currentUser : String ) { Text(text = currentUser) } `

    question 
    opened by RoustamManookian 18
  • Accompanist `0.24.x` makes breaking animation API change.

    Accompanist `0.24.x` makes breaking animation API change.

    I'm trying to upgrade to project to Kotlin 1.6.21. This necessitates that we bump compose to 1.2.0-beta01, and accompanist to 0.24.x. Accompanist makes the backwards incompatible change to remove NavGraphBuilder.navigate. Bumping both of those dependencies in my codebase causes the following runtime error, presumably because compose-destinations still depends on accompanist 0.23.x.

        java.lang.NoSuchMethodError: No static method navigation(Landroidx/navigation/NavGraphBuilder;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V in class Lcom/google/accompanist/navigation/animation/NavGraphBuilderKt; or its super classes (declaration of 'com.google.accompanist.navigation.animation.NavGraphBuilderKt' appears in /data/app/energy.octopus.octopusenergy.android.dev-p-WC31HpQkXr2Tkqenj6zg==/base.apk!classes20.dex)
            at com.ramcosta.composedestinations.animations.AnimatedNavHostEngine.navigation(AnimatedNavHostEngine.kt:102)
            at com.ramcosta.composedestinations.DestinationsNavHostKt.addNestedNavGraphs(DestinationsNavHost.kt:124)
            at com.ramcosta.composedestinations.DestinationsNavHostKt.addNavGraphDestinations(DestinationsNavHost.kt:106)
            at com.ramcosta.composedestinations.DestinationsNavHostKt.access$addNavGraphDestinations(DestinationsNavHost.kt:1)
            at com.ramcosta.composedestinations.DestinationsNavHostKt$DestinationsNavHost$2.invoke(DestinationsNavHost.kt:74)
            at com.ramcosta.composedestinations.DestinationsNavHostKt$DestinationsNavHost$2.invoke(DestinationsNavHost.kt:68)
            at com.google.accompanist.navigation.animation.AnimatedNavHostKt.AnimatedNavHost(AnimatedNavHost.kt:252)
            at com.ramcosta.composedestinations.animations.AnimatedNavHostEngine.NavHost(AnimatedNavHostEngine.kt:83)
            at com.ramcosta.composedestinations.DestinationsNavHostKt.DestinationsNavHost(DestinationsNavHost.kt:68)
    
    opened by kevincianfarini 18
  • NoSuchElementException: List contains no element matching the predicate.

    NoSuchElementException: List contains no element matching the predicate.

    Hi

    I updated the Android Studio to "Android Studion Chipmunk - 2021.2.1 Patch1" and now I get a NoSuchElementException: List contains no element matching the predicate.

    I am not sure that the problem is in the "navigation destination" package but it seems like that, because I commented all the other lines and only when I uncomment the line where it navigates to the next screen I ger the exception.

    java.util.NoSuchElementException: List contains no element matching the predicate. at androidx.navigation.compose.NavHostKt$NavHost$4.invoke(NavHost.kt:181) at androidx.navigation.compose.NavHostKt$NavHost$4.invoke(NavHost.kt:141) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34) at androidx.compose.animation.CrossfadeKt$Crossfade$4$1.invoke(Crossfade.kt:115) at androidx.compose.animation.CrossfadeKt$Crossfade$4$1.invoke(Crossfade.kt:110) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34) at androidx.compose.animation.CrossfadeKt.Crossfade(Crossfade.kt:124) at androidx.compose.animation.CrossfadeKt.Crossfade(Crossfade.kt:55) at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:141) at androidx.navigation.compose.NavHostKt$NavHost$5.invoke(Unknown Source:13) at androidx.navigation.compose.NavHostKt$NavHost$5.invoke(Unknown Source:10) at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:142) at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2351) at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2611) at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3198) at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3176) at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:252) at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:1) at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3176) at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3141) at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:727) at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:876) at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:107) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:485) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:454) at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:34) at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109) at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41) at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:970) at android.view.Choreographer.doCallbacks(Choreographer.java:796) at android.view.Choreographer.doFrame(Choreographer.java:727) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@5545588, StandaloneCoroutine{Cancelling}@6280b21, AndroidUiDispatcher@ef6fb46]

    duplicate 
    opened by RoustamManookian 17
  • How to listen BottomSheet state

    How to listen BottomSheet state

    How to listen ModalBottomSheetState? I want to listen it. I want to know whether it is ModalBottomSheetValue.HalfExpanded or ModalBottomSheetValue.Expanded. It seems difficult to implement it. Sorry for my poor English.

    opened by ShellWen 0
  • Conditional destination style

    Conditional destination style

    Hi!

    First of all thank you so much for this amazing library, it's been really useful! ā¤ļø

    Since adaptative design is becoming a thing and some of us are trying to design for tablets, wearables, laptops, etc, I wanted to have different destination styles depending on each device. For example, on a phone I'd like to open a screen on full screen or a bottom sheet, but for larger screens I'd rather choose to open a dialog or something similar.

    Is there any mechanism to achieve it?

    Thanks!

    help wanted 
    opened by costular 2
  • Generated source dependencies not found under canary AGP 8.0.0-alpha09

    Generated source dependencies not found under canary AGP 8.0.0-alpha09

    Setting up a project to use compose-destinations with the android gradle plugin 8.0.0-alpha09 does generated the correct sources but they are not correctly picked up by setting the source dir to the generated folder.

    Using the current stable version 7.3.1 of the AGP plugin does work as expected.

    Is there some documentation on what version of the AGP plugin is compatible? Also is there a way to make it work with the Canary version?

    dependency 
    opened by mpost 5
  • Unit test execution fails

    Unit test execution fails

    Hi I am using this library in my application and it is working fine when I build it (through both studio and CI pipeline). But while executing unit testcases, I am getting below error always. I am wondering whether there is something I need to do to handle this.

    `Execution optimizations have been disabled for task ':app:kspReleaseKotlin' to ensure correctness due to the following reasons:

    • Gradle detected a problem with the following location: '/builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin'. Reason: Task ':app:kspReleaseKotlin' uses this output of task ':app:kspDebugKotlin' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#implicit_dependency for more details about this problem.

    Task :app:kaptStagingKotlin Task :app:kaptDebugKotlin Task :app:kaptReleaseKotlin Task :app:compileStagingKotlin Execution optimizations have been disabled for task ':app:compileStagingKotlin' to ensure correctness due to the following reasons:

    • Gradle detected a problem with the following location: '/builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin'. Reason: Task ':app:compileStagingKotlin' uses this output of task ':app:kspDebugKotlin' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#implicit_dependency for more details about this problem. e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (15, 12): Redeclaration: NavGraph e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (30, 11): Conflicting declarations: public val Route.startDestination: Destination /* = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (37, 23): Conflicting declarations: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (38, 13): Overload resolution ambiguity: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (44, 1): Conflicting overloads: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/NavGraphs.kt: (10, 8): Redeclaration: NavGraphs e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/destinations/CreatePasswordDestination.kt: (16, 8): Redeclaration: CreatePasswordDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/destinations/DashboardDestination.kt: (15, 8): Redeclaration: DashboardDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (15, 12): Redeclaration: NavGraph e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (30, 11): Conflicting declarations: public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (37, 23): Conflicting declarations: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (38, 13): Overload resolution ambiguity: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (44, 1): Conflicting overloads: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/NavGraphs.kt: (10, 8): Redeclaration: NavGraphs e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/destinations/CreatePasswordDestination.kt: (16, 8): Redeclaration: CreatePasswordDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/destinations/DashboardDestination.kt: (15, 8): Redeclaration: DashboardDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (15, 12): Redeclaration: NavGraph e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (30, 11): Conflicting declarations: public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (37, 23): Conflicting declarations: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (38, 13): Overload resolution ambiguity: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (44, 1): Conflicting overloads: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? */ defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/NavGraphs.kt: (10, 8): Redeclaration: NavGraphs e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/destinations/CreatePasswordDestination.kt: (16, 8): Redeclaration: CreatePasswordDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/destinations/DashboardDestination.kt: (15, 8): Redeclaration: DashboardDestination

    Task :app:compileStagingKotlin FAILED Task :app:compileReleaseKotlin FAILED Execution optimizations have been disabled for task ':app:compileReleaseKotlin' to ensure correctness due to the following reasons:

    • Gradle detected a problem with the following location: '/builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin'. Reason: Task ':app:compileReleaseKotlin' uses this output of task ':app:kspDebugKotlin' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#implicit_dependency for more details about this problem.
    • Gradle detected a problem with the following location: '/builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin'. Reason: Task ':app:compileReleaseKotlin' uses this output of task ':app:kspStagingKotlin' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#implicit_dependency for more details about this problem. e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (15, 12): Redeclaration: NavGraph e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (30, 11): Conflicting declarations: public val Route.startDestination: Destination /* = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (37, 23): Conflicting declarations: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (38, 13): Overload resolution ambiguity: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (44, 1): Conflicting overloads: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/NavGraphs.kt: (10, 8): Redeclaration: NavGraphs e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/destinations/CreatePasswordDestination.kt: (16, 8): Redeclaration: CreatePasswordDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/destinations/DashboardDestination.kt: (15, 8): Redeclaration: DashboardDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (15, 12): Redeclaration: NavGraph e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (30, 11): Conflicting declarations: public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (37, 23): Conflicting declarations: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (38, 13): Overload resolution ambiguity: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (44, 1): Conflicting overloads: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/NavGraphs.kt: (10, 8): Redeclaration: NavGraphs e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/destinations/CreatePasswordDestination.kt: (16, 8): Redeclaration: CreatePasswordDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/destinations/DashboardDestination.kt: (15, 8): Redeclaration: DashboardDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (15, 12): Redeclaration: NavGraph e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (30, 11): Conflicting declarations: public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (37, 23): Conflicting declarations: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (38, 13): Overload resolution ambiguity: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (44, 1): Conflicting overloads: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? */ defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/NavGraphs.kt: (10, 8): Redeclaration: NavGraphs e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/destinations/CreatePasswordDestination.kt: (16, 8): Redeclaration: CreatePasswordDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/destinations/DashboardDestination.kt: (15, 8): Redeclaration: DashboardDestination

    Task :app:compileDebugKotlin FAILED Execution optimizations have been disabled for task ':app:compileDebugKotlin' to ensure correctness due to the following reasons:

    • Gradle detected a problem with the following location: '/builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin'. Reason: Task ':app:compileDebugKotlin' uses this output of task ':app:kspReleaseKotlin' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#implicit_dependency for more details about this problem.
    • Gradle detected a problem with the following location: '/builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin'. Reason: Task ':app:compileDebugKotlin' uses this output of task ':app:kspStagingKotlin' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#implicit_dependency for more details about this problem. e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (15, 12): Redeclaration: NavGraph e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (30, 11): Conflicting declarations: public val Route.startDestination: Destination /* = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (37, 23): Conflicting declarations: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (38, 13): Overload resolution ambiguity: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (44, 1): Conflicting overloads: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/NavGraphs.kt: (10, 8): Redeclaration: NavGraphs e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/destinations/CreatePasswordDestination.kt: (16, 8): Redeclaration: CreatePasswordDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/debug/kotlin/com/mywork/myapplication/presentation/destinations/DashboardDestination.kt: (15, 8): Redeclaration: DashboardDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (15, 12): Redeclaration: NavGraph e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (30, 11): Conflicting declarations: public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (37, 23): Conflicting declarations: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (38, 13): Overload resolution ambiguity: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (44, 1): Conflicting overloads: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/NavGraphs.kt: (10, 8): Redeclaration: NavGraphs e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/destinations/CreatePasswordDestination.kt: (16, 8): Redeclaration: CreatePasswordDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/release/kotlin/com/mywork/myapplication/presentation/destinations/DashboardDestination.kt: (15, 8): Redeclaration: DashboardDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (15, 12): Redeclaration: NavGraph e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (30, 11): Conflicting declarations: public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> /, public val Route.startDestination: Destination / = TypedDestination<> / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (37, 23): Conflicting declarations: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? /, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (38, 13): Overload resolution ambiguity: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/CoreExtensions.kt: (44, 1): Conflicting overloads: public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public fun NavBackStackEntry.navDestination(navGraph: NavGraph = ...): Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? / defined in com.mywork.myapplication.presentation in file CoreExtensions.kt, public val NavBackStackEntry.navDestination: Destination? / = TypedDestination<>? */ defined in com.mywork.myapplication.presentation in file CoreExtensions.kt e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/NavGraphs.kt: (10, 8): Redeclaration: NavGraphs e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/destinations/CreatePasswordDestination.kt: (16, 8): Redeclaration: CreatePasswordDestination e: /builds/mobile-app/android/myapplication/app/build/generated/ksp/staging/kotlin/com/mywork/myapplication/presentation/destinations/DashboardDestination.kt: (15, 8): Redeclaration: DashboardDestination FAILURE: Build completed with 3 failures.`
    help wanted 
    opened by SeethalakshmiSoman 4
  • Result return is no longer being passed on back navigation since version 1.7.23-beta

    Result return is no longer being passed on back navigation since version 1.7.23-beta

    Navigation on result does happens but doesn't pass the value older version than 1.7.23-beta works perfectly fine but after this =(

    @Destination
    @Composable
    fun BarcodeScanScreen(
        navigator: DestinationsNavigator,
        resultNavigator: ResultBackNavigator<String>,
        reason: BarcodeScanReason,
        resultRecipientProductList: ResultRecipient<ProductListScreenDestination, Boolean>,
        resultRecipientInboundStock: ResultRecipient<InboundStockScreenDestination, Boolean>,
        resultRecipientQuantityStock: ResultRecipient<QuantityStockScreenDestination, Boolean>
    ) {
      .
      .
      .
    resultRecipientProductList.onNavResult { navResult ->
            when (navResult) {
                NavResult.Canceled -> Unit
                is NavResult.Value -> when (reason) {
                    BarcodeScanReason.INBOUND_STOCKING -> viewModel.onInboundedStock(navResult.value)
                    BarcodeScanReason.CORRECTION -> viewModel.onQuantityStock(navResult.value)
                    else -> Unit
                }
            }
        }
    }
    
    opened by golovkov-llc 1
Releases(1.7.30-beta)
  • 1.7.30-beta(Dec 30, 2022)

    What's Changed

    • Initial version of Wear OS support by @yschimke in https://github.com/raamcosta/compose-destinations/pull/322

    To use it, import the corresponding core dependency:

    implementation 'io.github.raamcosta.compose-destinations:wear-core:1.7.30-beta'

    Then create a wear os NavHostEngine and pass it to the DestinationsNavHost composable:

    val engine = rememberWearNavHostEngine()
    
    DestinationsNavHost(
        engine = engine,
        //... same thing as with normal lib usage
    )
    

    New Contributors

    • @yschimke made their first contribution in https://github.com/raamcosta/compose-destinations/pull/322

    Full Changelog: https://github.com/raamcosta/compose-destinations/compare/1.7.27-beta...1.7.30-beta

    Source code(tar.gz)
    Source code(zip)
  • 1.6.30-beta(Dec 30, 2022)

    • Added support for Wear OS! Thanks to @yschimke who did most of the work šŸ™‡

    To use it, import the corresponding core dependency:

    implementation 'io.github.raamcosta.compose-destinations:wear-core:1.7.30-beta'

    Then create a wear os NavHostEngine and pass it to the DestinationsNavHost composable:

    val engine = rememberWearNavHostEngine()
    
    DestinationsNavHost(
        engine = engine,
        //... same thing as with normal lib usage
    )
    

    Full Changelog: https://github.com/raamcosta/compose-destinations/compare/1.6.27-beta...1.6.30-beta

    Source code(tar.gz)
    Source code(zip)
  • 1.5.30-beta(Dec 30, 2022)

    • Added support for Wear OS! Thanks to @yschimke who did most of the work šŸ™‡

    To use it, import the corresponding core dependency:

    implementation 'io.github.raamcosta.compose-destinations:wear-core:1.7.30-beta'

    Then create a wear os NavHostEngine and pass it to the DestinationsNavHost composable:

    val engine = rememberWearNavHostEngine()
    
    DestinationsNavHost(
        engine = engine,
        //... same thing as with normal lib usage
    )
    

    Full Changelog: https://github.com/raamcosta/compose-destinations/compare/1.5.27-beta...1.5.30-beta

    Source code(tar.gz)
    Source code(zip)
  • 1.7.27-beta(Nov 18, 2022)

  • 1.6.27-beta(Nov 18, 2022)

  • 1.5.27-beta(Nov 18, 2022)

  • 1.7.26-beta(Nov 14, 2022)

    Changes

    • Created a Direction impl data class which will enable comparisons of two Directions with normal equals (or "=="). Especially useful in unit tests
    • Changed base64 related methods to not depend on android (except on older API devices). This enables route related code to run on unit tests (no roboelectric, only jvm).
    • Fixed #288 (thanks @hrafnthor šŸ™ )
    • Updated dependency versions (including navigation and compose)
    Source code(tar.gz)
    Source code(zip)
  • 1.6.26-beta(Nov 14, 2022)

    Changes

    • Created a Direction impl data class which will enable comparisons of two Directions with normal equals (or "=="). Especially useful in unit tests
    • Changed base64 related methods to not depend on android (except on older API devices). This enables route related code to run on unit tests (no roboelectric, only jvm).
    • Fixed #288 (thanks @hrafnthor šŸ™ )
    • Updated dependency versions (including navigation and compose)
    Source code(tar.gz)
    Source code(zip)
  • 1.5.26-beta(Nov 14, 2022)

    Changes

    • Created a Direction impl data class which will enable comparisons of two Directions with normal equals (or "=="). Especially useful in unit tests
    • Changed base64 related methods to not depend on android (except on older API devices). This enables route related code to run on unit tests (no roboelectric, only jvm).
    • Fixed #288 (thanks @hrafnthor šŸ™ )
    • Updated dependency versions
    Source code(tar.gz)
    Source code(zip)
  • 1.7.25-beta(Nov 2, 2022)

    Changes

    • Fixes #279: Implemented support for activity destinations.

    Example:

    data class OtherActivityNavArgs(
        val otherThing: String,
        val color: Color
    )
    
    @SettingsNavGraph
    @ActivityDestination(
        navArgsDelegate = OtherActivityNavArgs::class,
    )
    class OtherActivity: ComponentActivity() {
    
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
    
            val args = OtherActivityDestination.argsFrom(intent)
            println("OtherActivity args = $args")
    
            setContentView(ComposeView(this).apply {
                setContent {
                    Column(
                        modifier = Modifier.background(args.color)
                    ) {
                        Text("OTHER ACTIVITY")
                        Text("ARGS: \n$args")
                    }
                }
            })
        }
    }
    

    And to navigate to it:

    navigator.navigate(OtherActivityDestination(otherThing = "testing", color = Color.Magenta))
    
    Source code(tar.gz)
    Source code(zip)
  • 1.6.25-beta(Nov 2, 2022)

    Changes

    • Fixes #279: Implemented support for activity destinations.

    Example:

    data class OtherActivityNavArgs(
        val otherThing: String,
        val color: Color
    )
    
    @SettingsNavGraph
    @ActivityDestination(
        navArgsDelegate = OtherActivityNavArgs::class,
    )
    class OtherActivity: ComponentActivity() {
    
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
    
            val args = OtherActivityDestination.argsFrom(intent)
            println("OtherActivity args = $args")
    
            setContentView(ComposeView(this).apply {
                setContent {
                    Column(
                        modifier = Modifier.background(args.color)
                    ) {
                        Text("OTHER ACTIVITY")
                        Text("ARGS: \n$args")
                    }
                }
            })
        }
    }
    

    And to navigate to it:

    navigator.navigate(OtherActivityDestination(otherThing = "testing", color = Color.Magenta))
    
    Source code(tar.gz)
    Source code(zip)
  • 1.5.25-beta(Nov 2, 2022)

    Changes

    • Fixes #279: Implemented support for activity destinations.

    Example:

    data class OtherActivityNavArgs(
        val otherThing: String,
        val color: Color
    )
    
    @SettingsNavGraph
    @ActivityDestination(
        navArgsDelegate = OtherActivityNavArgs::class,
    )
    class OtherActivity: ComponentActivity() {
    
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
    
            val args = OtherActivityDestination.argsFrom(intent)
            println("OtherActivity args = $args")
    
            setContentView(ComposeView(this).apply {
                setContent {
                    Column(
                        modifier = Modifier.background(args.color)
                    ) {
                        Text("OTHER ACTIVITY")
                        Text("ARGS: \n$args")
                    }
                }
            })
        }
    }
    

    And to navigate to it:

    navigator.navigate(OtherActivityDestination(otherThing = "testing", color = Color.Magenta))
    
    Source code(tar.gz)
    Source code(zip)
  • 1.7.23-beta(Oct 25, 2022)

    Changes

    • Fixed issue when NavTypeSerializer uses a typealias as its type argument.
    • Fix Nested and serializable typealiases nav arguments (thanks Martin JantoÅ”ovič aka @Mordred)
    • Fix NullPointerException for navArgsDelegate classes coming from class files (thanks Martin JantoÅ”ovič aka @Mordred)
    • Navigating back onlyIfResumed option added. (thanks Petr Stetka aka @petrstetka)
    • Fixes #221: adds ksp configuration to choose whether to use annotated composables visibility or default to public.
    • Fixes #263
    Source code(tar.gz)
    Source code(zip)
  • 1.6.23-beta(Oct 25, 2022)

    Changes

    • Fixed issue when NavTypeSerializer uses a typealias as its type argument.
    • Fix Nested and serializable typealiases nav arguments (thanks Martin JantoÅ”ovič aka @Mordred)
    • Fix NullPointerException for navArgsDelegate classes coming from class files (thanks Martin JantoÅ”ovič aka @Mordred)
    • Navigating back onlyIfResumed option added. (thanks Petr Stetka aka @petrstetka)
    • Fixes #221: adds ksp configuration to choose whether to use annotated composables visibility or default to public.
    • Fixes #263
    Source code(tar.gz)
    Source code(zip)
  • 1.5.23-beta(Oct 25, 2022)

    Changes

    • Fixed issue when NavTypeSerializer uses a typealias as its type argument.
    • Fix Nested and serializable typealiases nav arguments (thanks Martin JantoÅ”ovič aka @Mordred)
    • Fix NullPointerException for navArgsDelegate classes coming from class files (thanks Martin JantoÅ”ovič aka @Mordred)
    • Navigating back onlyIfResumed option added. (thanks Petr Stetka aka @petrstetka)
    • Fixes #221: adds ksp configuration to choose whether to use annotated composables visibility or default to public.
    • Fixes #263
    Source code(tar.gz)
    Source code(zip)
  • 1.7.22-beta(Oct 9, 2022)

    1. Refactored some of the utility functions to correctly account for the possibility of a NavBackStackEntry corresponding to a NavGraph entry and not a Destination one.

    2. Fixes #252 : Added Stable annotation to DestinationsNavigator

    3. Improved internal route building to use "&" instead of "?" for non mandatory arguments other than the first one. (thanks @Mordred )

    4. Fixes #221 : Added explicity types and visibility. Also made generated Destination be declared as internal if corresponding annotated Composable is.

    Source code(tar.gz)
    Source code(zip)
  • 1.6.22-beta(Oct 9, 2022)

    1. Refactored some of the utility functions to correctly account for the possibility of a NavBackStackEntry corresponding to a NavGraph entry and not a Destination one.

    2. Fixes #252 : Added Stable annotation to DestinationsNavigator

    3. Improved internal route building to use "&" instead of "?" for non mandatory arguments other than the first one. (thanks @Mordred )

    4. Fixes #221 : Added explicity types and visibility. Also made generated Destination be declared as internal if corresponding annotated Composable is.

    Source code(tar.gz)
    Source code(zip)
  • 1.5.22-beta(Oct 9, 2022)

    1. Refactored some of the utility functions to correctly account for the possibility of a NavBackStackEntry corresponding to a NavGraph entry and not a Destination one.

    2. Fixes #252 : Added Stable annotation to DestinationsNavigator

    3. Improved internal route building to use "&" instead of "?" for non mandatory arguments other than the first one. (thanks @Mordred )

    4. Fixes #221 : Added explicity types and visibility. Also made generated Destination be declared as internal if corresponding annotated Composable is.

    Source code(tar.gz)
    Source code(zip)
  • 1.7.21-beta(Sep 13, 2022)

  • 1.6.20-beta(Sep 13, 2022)

  • 1.5.20-beta(Sep 13, 2022)

  • 1.7.19-beta(Sep 7, 2022)

  • 1.6.19-beta(Sep 7, 2022)

  • 1.5.19-beta(Sep 7, 2022)

  • 1.7.17-beta(Aug 31, 2022)

  • 1.6.17-beta(Aug 31, 2022)

  • 1.5.17-beta(Aug 31, 2022)

  • 1.7.16-beta(Aug 21, 2022)

  • 1.6.16-beta(Aug 21, 2022)

  • 1.5.16-beta(Aug 21, 2022)

Owner
Rafael Costa
Rafael Costa
Missing safe arguments generator for Compose Navigation

Safe Arguments Generator Yet another attempt to add safe arguments to Compose Navigation. Why Since routes in Navigation Component don't support safe

Vitali Olshevski 9 Nov 3, 2022
Compose-navigation - Set of utils to help with integrating Jetpack Compose and Jetpack's Navigation

Jetpack Compose Navigation Set of utils to help with integrating Jetpack Compose

Adam Kobus 5 Apr 5, 2022
Small Android project demonstrating some navigation components for Jetpack Compose.

Small Android project demonstrating some navigation components for Jetpack Compose. Created this for presenting about this topic for a GDG meetup.

Parshav 3 Sep 15, 2021
unfurl extracts social metadata of webpages for generating link previews

unfurl unfurl extracts social metadata of webpages for generating link previews, inspired by slack. val unfurler = Unfurler() println(unfurler.unfurl(

Saket Narayan 230 Dec 24, 2022
Kapture - A small library for Jetpack Compose to capture Composable content to Android Bitmap

kapture A small utility library for Jetpack Compose to capture Composable conten

Kaustubh Patange 10 Dec 9, 2022
Navigation-Compose - A sample to showcase Kotlin, MVVM, Hilt, Coroutines, StateFlow, Jetpack compose

Navigation-Compose A sample to showcase Kotlin, MVVM, Hilt, Coroutines, StateFlo

Mohammadali Rezaei 6 Jul 13, 2022
A Simple Blog App using Jetpack Compose, Flow, Navigation Compose, Room and Firebase

BlogCompose A Simple Blog App using Jetpack Compose, Flow, Navigation Compose, Room and Firebase Instructions Download your Firebase configuration fil

null 4 Oct 10, 2022
Forget about bunch of XML files for maintaining UIs. Jetpack Compose is Androidā€™s modern toolkit for building native UI. Here is a small example to get started.

Jetpack Compose Sample Description This repository is to get started with new Jetpack Compose Toolkit for Android. By using Jetpack Compose you no nee

Simform Solutions 39 Nov 10, 2022
This repos one of the ways hows how to use Jetpack Compose Navigation along with Dagger 2

Dagger 2 and Jetpack Compose Integration This repository is about a way how to use Dagger 2 for projects which using Jetpack Compose. Here is an artic

Alexey Glukharev 10 Nov 16, 2022
Create Bottom Navigation Bar with Jetpack Compose

BottomNavigationBarComposeExample Create Bottom Navigation Bar with Jetpack Compose https://johncodeos.com/how-to-create-bottom-navigation-bar-with-je

JohnCodeos.com 31 Dec 24, 2022
Kotlin, MVVM, Navigation Component, Hilt, Jetpack Compose, Retrofit2

What is this project? This course will replace my old java mvvm introduction: https://codingwithmitch.com/courses/rest-api-mvvm-retrofit2/. Watch the

Mitch Tabian 452 Jan 1, 2023
[Tutorial] D-pad navigation in Jetpack Compose

dpad-compose D-pad navigation in Jetpack Compose The problem While Android is mostly used on touch devices, the operating system can also be used with

Walter Berggren 34 Nov 4, 2022
Android Sample Kotlin+ MVI + Jetpack compose + Coroutines + Retrofit + Hilt + Room + Navigation component

MVIComposeSample Android Sample app to show user latest movies implementing MVI + Clean Architecture using kotlin & Jetpack compose following solid an

Ahmed Atwa 10 Dec 28, 2022
Android App made by Jetpack Compose Components with Kotlin, MVVM Pattern, Multi Module, Navigation, Hilt, Coroutines, Retrofit and cached data by Room

Android App made by Jetpack Compose Components with Kotlin, MVVM Pattern, Multi Module, Navigation, Hilt, Coroutines, Retrofit and cached data by Room

Yogi Dewansyah 13 Aug 31, 2022
Android App made by Jetpack Compose Components with Kotlin, MVVM Pattern, Multi Module, Navigation, Hilt, Coroutines, Retrofit and cached data by Room

Mobile Banking Android App made by Jetpack Compose Components with Kotlin, MVVM Pattern, Multi Module, Navigation, Hilt, Coroutines, Retrofit and cach

Yogi Dewansyah 13 Aug 31, 2022
Model-driven navigation for Jetpack Compose

Model-driven navigation for Jetpack Compose

null 588 Dec 27, 2022
Odyssey it's a declarative multiplatform navigation library for Multiplatform Compose

Odyssey Odyssey it's a declarative multiplatform navigation library for Multiplatform Compose ?? WARNING! It's an early preview, so you use it with yo

Alex 168 Jan 5, 2023
This library is a helper for the Android Compose Navigation routes

ComposableRoutes This library is a helper for the Android Compose Navigation routes: generates routes for the annotated screens provides helpers to re

Rostyslav Lesovyi 19 Nov 5, 2022
Compose desktop navigation library

Navipose Compose desktop navigation library Features Now navipose supports basic screen navigation between few screens Examples At first you should cr

null 5 Oct 28, 2022