Skip to content
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

Merged
merged 4 commits into from
Oct 31, 2023

Conversation

swankjesse
Copy link
Collaborator

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.

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.
public val stateSnapshot: StateSnapshot?

public fun addOnBackPressedCallback(callback: OnBackPressedCallbackService): CancellableService
}
Copy link
Collaborator Author

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.

@swankjesse
Copy link
Collaborator Author

Part of #1458

Copy link
Contributor

@veyndan veyndan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update #1539?

@swankjesse
Copy link
Collaborator Author

Good call. Done.

squarejesse and others added 2 commits October 31, 2023 12:31
…/treehouse/treehouseCompose.kt

Co-authored-by: Jake Wharton <jw@squareup.com>
@swankjesse swankjesse merged commit 51ece61 into trunk Oct 31, 2023
8 checks passed
@swankjesse swankjesse deleted the jwilson.1027.ZiplineTreehouseApi.Host branch October 31, 2023 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants