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

Toast is persisted through configuration changes #592

Closed
wants to merge 1 commit into from
Closed

Conversation

gerak-cz
Copy link
Contributor

@gerak-cz gerak-cz commented Dec 4, 2023

The currently displayed toast and any queued toasts are persisted through configuration changes.

To achieve this, the ToastHostState has to rely on a callback rather than suspending function. This is a breaking change in the API.

refs #576

…ough configuration changes.

 To achieve this, the ToastHostState has to rely on a callback rather than suspending function. This is a breaking change in the API.
@gerak-cz gerak-cz requested a review from a team as a code owner December 4, 2023 15:24
@hrach hrach added the feature New feature or request label Dec 4, 2023
@@ -49,7 +49,7 @@ import kotlinx.coroutines.launch

public interface ToastData {
public val message: String
public val icon: @Composable (() -> Painter)?
public val iconName: IconName?
Copy link
Contributor

@shanio shanio Dec 5, 2023

Choose a reason for hiding this comment

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

I would really like the name to be part of "Painter" in icons (e.g. by encapsulating the painter in our own object or similarly...), it would allow to stick with usage of Icons even here, internally it would derive the name and back through your mapping, but that's just a wish I guess.

Copy link
Contributor

Choose a reason for hiding this comment

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

How would you deserialize the name back to the painter - especially in the case of your own set of icons?

@@ -49,7 +49,7 @@ import kotlinx.coroutines.launch

public interface ToastData {
public val message: String
public val icon: @Composable (() -> Painter)?
public val iconName: IconName?
Copy link
Contributor

Choose a reason for hiding this comment

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

How would you deserialize the name back to the painter - especially in the case of your own set of icons?


@Composable
public fun rememberToastHostState(
onDismiss: () -> Unit = {},
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say onDismiss should receive the ToastData. +-

@gerak-cz
Copy link
Contributor Author

Closing this PR. Surpassed by #596 where we can continue our discussion.

@gerak-cz gerak-cz closed this Dec 11, 2023
@gerak-cz gerak-cz deleted the toast-saver branch December 11, 2023 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants