Skip to content

Conversation

@jvsena42
Copy link
Member

@jvsena42 jvsena42 commented Dec 9, 2025

closes #505

Description

This PR implements a queue logic to toasts and fixes the horizontal dismiss wipe animation

Preview

different-toasts.webm
same-toast-type.webm

QA Notes

For mock:

                        //TODO DONT COMMIT
                        TabBar(
                            onSendClick = { appViewModel.toast(
                                Toast(
                                    type = Toast.ToastType.SUCCESS,
                                    title = "You're Back Online!",
                                    description = "Successfully reconnected to the Internet.",
                                    autoHide = true,
                                )
                            ) },
                            onReceiveClick = { appViewModel.toast(
                                Toast(
                                    type = Toast.ToastType.INFO,
                                    title = "General Message",
                                    description = "Used for neutral content to inform the user.",
                                    autoHide = false,
                                )
                            ) },
                            onScanClick = {
                                appViewModel.toast(
                                    // Toast(
                                    //     type = Toast.ToastType.SUCCESS,
                                    //     title = "You're Back Online!",
                                    //     description = "success message 2",
                                    //     autoHide = true,
                                    // )
                                    Toast(
                                        type = Toast.ToastType.WARNING,
                                        title = "Warning title",
                                        description = "warning body",
                                        autoHide = true,
                                    )
                                )
                            },
                            modifier = Modifier.align(Alignment.BottomCenter)
                        )

@jvsena42 jvsena42 self-assigned this Dec 9, 2025
@jvsena42 jvsena42 changed the title Fix/toast polish fix: Toast polish Dec 9, 2025
@jvsena42 jvsena42 marked this pull request as ready for review December 9, 2025 14:37
@jvsena42 jvsena42 requested a review from Copilot December 9, 2025 14:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a queue management system for toasts to ensure sequential display and improves the horizontal dismiss swipe animation. The changes introduce a dedicated ToastQueueManager class that handles toast queuing with pause/resume capabilities, replacing the previous single-toast state management.

Key Changes:

  • Introduced ToastQueueManager class to handle toast queue with a maximum size of 5, sequential display, and pause/resume functionality
  • Refactored AppViewModel to use ToastQueueManager instead of direct state management
  • Enhanced horizontal swipe dismiss animation in ToastView to complete the off-screen animation

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
ToastQueueManager.kt New class implementing queue logic with auto-hide timers, pause/resume support, and sequential toast display
AppViewModel.kt Refactored to delegate toast management to ToastQueueManager with new pause/resume/clear methods
ToastView.kt Enhanced horizontal swipe dismiss to animate toast off-screen before dismissing
MainActivity.kt Updated to collect toast as StateFlow and wire up pause/resume callbacks

ovitrif
ovitrif previously approved these changes Dec 9, 2025
Copy link
Collaborator

@ovitrif ovitrif left a comment

Choose a reason for hiding this comment

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

tACK

Approved with some nits for code cleanup.

Very nice solution 👏🏻

@jvsena42
Copy link
Member Author

jvsena42 commented Dec 10, 2025

@ovitrif implemented the suggestions from here and also some from #501

Screen_recording_20251210_073056.webm

@jvsena42 jvsena42 requested a review from ovitrif December 10, 2025 10:37
@jvsena42 jvsena42 enabled auto-merge December 10, 2025 10:37
@ovitrif
Copy link
Collaborator

ovitrif commented Dec 10, 2025

@jvsena42 FYI I'm also working on a fix to resolve

planning to land it in:

@jvsena42
Copy link
Member Author

@jvsena42 FYI I'm also working on a fix to resolve

planning to land it in:

Thanks! on this case, assign the issue to yourself could prevent someone else take it

Copy link
Collaborator

@ovitrif ovitrif left a comment

Choose a reason for hiding this comment

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

LGTM 👏🏻

@jvsena42 jvsena42 merged commit f556b2f into master Dec 10, 2025
17 checks passed
@jvsena42 jvsena42 deleted the fix/toast-polish branch December 10, 2025 11:04
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.

Toast triggered while another one shows is dismissing the old toast and itself

3 participants