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

Simplify creation of new screens #1525

Merged
merged 1 commit into from
Sep 28, 2023
Merged

Simplify creation of new screens #1525

merged 1 commit into from
Sep 28, 2023

Conversation

JakeWharton
Copy link
Collaborator

@JakeWharton JakeWharton commented Sep 28, 2023

This also changes from an enum key to a string key so that we can switch to rememberSaveable soon (#1518).

This also changes from an enum key to a string key so that we can switch to rememberSaveable soon.
Comment on lines +58 to +59
if (content == null) {
Text("No screen found with key '$screenKey'!")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought about automatically falling back to home, but if we get rememberSaveable, you rename a key, and the app reloads, I want what happened to be slightly more clear.

@JakeWharton
Copy link
Collaborator Author

We get nice screen names now because they're strings.

Screenshot_20230927_170830
Screenshot 2023-09-27 at 5 08 42 PM
Screenshot 2023-09-27 at 5 09 01 PM

Comment on lines +40 to +42
class TestContext(
val httpClient: HttpClient,
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This will become a context receiver eliminating the need to explicitly pass any values in the lambdas above.

@JakeWharton JakeWharton merged commit 89750b1 into trunk Sep 28, 2023
8 checks passed
@JakeWharton JakeWharton deleted the jw.simplify.2023-09-27 branch September 28, 2023 13:05
@ahmed3elshaer
Copy link
Contributor

@JakeWharton I appreciate your effort in doing this task. I tried to implement #1518 yesterday, but it did not work as expected. I realized that the reason was the enum screen now.

@JakeWharton
Copy link
Collaborator Author

Yeah a string should work much better with rememberSaveable, at least as it's written today. Eventually it'll support custom savers where we could have written an adapter for an enum, but a string is easier all-around.

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.

3 participants