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

Introduces fun Screen.deepMap(Screen): Screen #1092

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

rjrjr
Copy link
Contributor

@rjrjr rjrjr commented Jul 18, 2023

Introduces and uses Screen-specific subtypes of the Container and Wrapper interfaces. This allows the inroduction of Screen.deepMap(), which allows us to apply a transformation to the "real" Screens collected in a Container, no matter how deeply wrapped they are.

Introduces and uses `Screen`-specific subtypes of the `Container` and `Wrapper` interfaces. This allows the inroduction of `Screen.deepMap()`, which allows us to apply a transformation to the "real" `Screen`s collected in a `Container`, no matter how deeply wrapped they are.
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@rjrjr rjrjr marked this pull request as ready for review November 16, 2023 20:01
@rjrjr rjrjr requested review from zach-klippenstein and a team as code owners November 16, 2023 20:01
package com.squareup.workflow1.ui

@WorkflowUiExperimentalApi
public interface VisualHolder<in RenderingT, out VisualT> {
Copy link
Member

Choose a reason for hiding this comment

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

It seems like some of the kdoc for VisualFactory.createOrNull should be here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Uh oh. I think this and VisualHolder leaked in from an unrelated PR.

*/
@WorkflowUiExperimentalApi
public fun Screen.deepMap(transform: (Screen) -> Screen): Screen {
return if (this is ScreenContainer<*>) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

You know what? I don't know that ScreenContainer is actually necessary for this. I'm going to put this PR back into draft.

  • ScreenContainer probably isn't necessary.

context: ContextT,
environment: ViewEnvironment,
getFactory: (ViewEnvironment) -> VisualFactory<ContextT, Any, VisualT>
): VisualHolder<RenderingT, VisualT>?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rjrjr rjrjr marked this pull request as draft November 16, 2023 20:39
@rjrjr rjrjr removed the request for review from zach-klippenstein November 16, 2023 20:40
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.

None yet

2 participants