Skip to content

Starting activities from Jetpack Compose Composables with Decompose #130

Answered by arkivanov
moffpage asked this question in Q&A
Discussion options

You must be logged in to vote

Personally I like explicity and compile-time safety. So I would go with the following solution:

// In module X

class ComponentX(
    componentContext: ComponentContext,
    private val startCamera: (CameraParams) -> Unit
) : ComponentContext by componentContext {

    fun onCameraResult(fileName: String) {
    }
}

class CameraParams
// In module Y

class ComponentY(
    componentContext: ComponentContext,
    private val startCamera: (CameraParams) -> Unit,
    private val startBrowser: (url: String) -> Unit
) : ComponentContext by componentContext {

    fun onCameraResult(fileName: String) {
        // Deliver the result to ComponentX
    }
}

class CameraParams
// In module Z

class C…

Replies: 2 comments 14 replies

Comment options

You must be logged in to vote
2 replies
@moffpage
Comment options

@Shabinder
Comment options

Comment options

You must be logged in to vote
12 replies
@moffpage
Comment options

@arkivanov
Comment options

@moffpage
Comment options

@arkivanov
Comment options

@moffpage
Comment options

Answer selected by moffpage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants