-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce compose.ui dependency and add Modifier to Ui.Content() (#422)
This is a breaking API change to `Ui.Content()` to add a `Modifier` parameter. There are breaking changes, but if using code gen it's fairly minimal. ```diff public interface Ui<UiState : CircuitUiState> { - @composable public fun Content(state: UiState) + @composable public fun Content(state: UiState, modifier: Modifier) } ``` We've been getting stuck on this for awhile now when trying to bridge to UI land and finally pulling the trigger on this to ease a bunch of things. At a high level, this replaces the toe-hold `ScreenUi` we've been keeping around as modifiers give us a means of plumbing down extra UI metadata, so I've removed it from the API. We can also offer a default onUnavailableContent API now, so I've made it non-nullable in `CircuitConfig` using that default. If people want the previous erroring behavior, they can still achieve this with a custom function of their own. One place this hits friction is UI libraries that don't use Modifiers (i.e. Mosaic), but it's easy enough to just ignore that parameter coming from `ui { state, _ -> ... }`. Other things - Realized our code gen artifact was sorta halfway multiplatform and resulted in confusing KSP configuration errors. Cleaned that up and made it just a standard JVM artifact. - Reworked how we generate UI factories a bit in code gen to make it simpler to maintain. Put a thorough diagram in for good measure. - Removed redundant wrapper `Box`es that were shims for this functionality missing. - It's not possible in abstract composable functions to add a default value. i.e. can't write `modifier: Modifier = Modifier` in the `Ui.Content(...)` signature. This does _add_ the compose UI dependency to circuit core, but after a lot of thought I think this is ok. Our android artifact already imposed it for all intents and purposes, this just drops that facade and embraces the fact that this is a UI architecture and not just a business logic layer using compose runtime only. Supersedes #406. Helps #50 too. Eases state sharing via modifiers. It would be easy to build modifiers that build upon each other with this and we no longer have a missing UI link.
- Loading branch information
Showing
31 changed files
with
304 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
POM_ARTIFACT_ID=circuit-codegen | ||
POM_NAME=Circuit (Codegen) | ||
POM_DESCRIPTION=Circuit (Codegen) | ||
circuit.noCompose=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.