feat: add unique toasts and platform-selective native appearance - #2
Merged
Conversation
- Introduced `ToastKit.UpdateUnique` and `ToastKit.DismissUnique` methods for updating and dismissing toasts by unique keys. - Updated Android and iOS implementations to handle unique keys in toast management. - Enhanced JavaScript API to support unique key operations in `PendingToastUpdate` and `Toast` classes. - Added tests for unique toast functionality, ensuring correct behavior for showing, updating, and dismissing toasts with unique identifiers.
…ustomizable appearance
…or improved readability and maintainability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
Added unique toast identities with:
unique()updateUnique()dismissUnique()Added native lifecycle-aware duplicate suppression across visible, queued, stacked, timed, and persistent toasts.
Added platform-selective native rendering:
Added Android Material 3 Snackbar rendering.
Added iOS Liquid Glass rendering on supported systems, with a native SwiftUI material fallback.
Preserved custom styling configuration for platforms using ToastKit's custom renderer.
Added sparse renderer switching through
update()andupdateUnique().Added equivalent JavaScript APIs.
Preserved existing action, dismissal, queue, stack, unique, progress, loading, and event pipelines.
Updated the README, table of contents, API reference, native-mode limitations, and changelog.
Added PHP and JavaScript tests for unique identities and native appearance.
Why?
ToastKit needed a reliable way to prevent duplicate notifications representing the same logical operation, regardless of whether the toast was visible, queued, stacked, timed, or persistent.
It also needed an opt-in way to use each platform's current native design language without replacing ToastKit's customizable renderer or deleting custom configuration intended for the other platform.
These changes keep the existing custom renderer as the default while allowing developers to select native appearance independently for iOS and Android.
How was it tested?
Automated validation
composer testnode --test resources/js/tests/*.test.jscomposer validate --strictnode --checknativephp.jsonJSON validationgit diff --checkRuntime checks
Native toast presentation was tested on both Android and iOS.
Android action and dismiss-control placement were also corrected after emulator testing.
Platforms tested
Mark only the platforms relevant to this change.
Breaking changes?
None.
ToastKit's existing custom renderer remains the default on both platforms. Unique toast behavior and native appearance are strictly opt-in.
Checklist