ZupIT / nimbus-compose

Library for enabling Server Driven UI in Jetpack Compose
Apache License 2.0
19 stars 8 forks source link

♻️ Adjust nimbus interface dependencies #24

Closed hernandazevedozup closed 2 years ago

hernandazevedozup commented 2 years ago

Usage: Initializes nimbus

private val nimbus = Nimbus(
        baseUrl = BASE_URL,
        components = customComponents,
        logger = AppLogger(),
        errorView = { throwable: Throwable, retry: () -> Unit ->
            CustomError(throwable = throwable, retry = retry)
        }
    )

val globalState = nimbus.globalState // Access global state

UI layer must provide nimbus with ProvideNimbus to the ui tree

AppTheme {
                // A surface container using the 'background' color from the theme
                Surface(color = MaterialTheme.colors.background) {
                    Column {
                        ProvideNimbus(nimbus) {
                             NimbusNavigator(viewRequest = ViewRequest("/present.json"))