-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New ZiplineTreehouseUi.Host bridges all host functions #1647
Conversation
At the moment we've got 4 host functions offered to each UI. In a follow-up I'd like to introduce a 5th. I'd like the process of adding a 5th to not require yet another start() overload, so I'm introducing this type to make additional features easier to add later.
redwood-treehouse-host/src/commonMain/kotlin/app/cash/redwood/treehouse/TreehouseAppContent.kt
Show resolved
Hide resolved
public val stateSnapshot: StateSnapshot? | ||
|
||
public fun addOnBackPressedCallback(callback: OnBackPressedCallbackService): CancellableService | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking introducing this Host abstraction is a bit less efficient than passing the 4 parameters inline. This is because we need an extra 2 host-guest bridges for the two value parameters (uiConfigurations and stateSnapshot) that were originally passed by value into start()
. I think this is a good tradeoff for simplicity.
Part of #1458 |
...treehouse/src/commonMain/kotlin/app/cash/redwood/treehouse/OnBackPressedDispatcherService.kt
Outdated
Show resolved
Hide resolved
redwood-treehouse/src/commonMain/kotlin/app/cash/redwood/treehouse/ZiplineTreehouseUi.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update #1539?
Good call. Done. |
redwood-treehouse-guest/src/commonMain/kotlin/app/cash/redwood/treehouse/treehouseCompose.kt
Outdated
Show resolved
Hide resolved
…/treehouse/treehouseCompose.kt Co-authored-by: Jake Wharton <jw@squareup.com>
At the moment we've got 4 host functions offered to each UI. In a follow-up I'd like to introduce a 5th. I'd like the process of adding a 5th to not require yet another start() overload, so I'm introducing this type to make additional features easier to add later.