Skip to content

feat: add unique toasts and platform-selective native appearance - #2

Merged
victorycodedev merged 5 commits into
mainfrom
feature/unique-toasts
Aug 29, 2026
Merged

feat: add unique toasts and platform-selective native appearance#2
victorycodedev merged 5 commits into
mainfrom
feature/unique-toasts

Conversation

@victorycodedev

Copy link
Copy Markdown
Owner

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:

    // Native on both platforms
    ->native()
    
    // Native on iOS, custom ToastKit renderer on Android
    ->native(ios: true, android: false)
    
    // Custom ToastKit renderer on iOS, native on Android
    ->native(ios: false, android: true)
  • 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() and updateUnique().

  • 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 test
    • 155 tests passed
    • 327 assertions
  • node --test resources/js/tests/*.test.js
    • 31 tests passed
  • composer validate --strict
  • JavaScript syntax checks using node --check
  • nativephp.json JSON validation
  • git diff --check
  • Android Kotlin compilation against a generated NativePHP Android project:
    ./gradlew :app:compileDebugKotlin --no-daemon
  • iOS Swift type-check using the iOS 26.2 SDK

Runtime 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.

  • PHP
  • JavaScript
  • Android
  • iOS
  • Not applicable / documentation only

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

  • Tests were added or updated where appropriate.
  • Existing relevant tests pass.
  • Documentation was updated where necessary.
  • Public API and event/bridge compatibility were considered.
  • Android/iOS behavior parity was considered where relevant.
  • No unnecessary native dependencies were introduced.
  • No secrets, tokens, temporary logging, or debugging code were committed.
  • Native changes were tested in a generated NativePHP application where practical.

- 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.
@victorycodedev
victorycodedev merged commit b6c014e into main Aug 29, 2026
2 checks passed
@victorycodedev
victorycodedev deleted the feature/unique-toasts branch August 29, 2026 19:42
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.

1 participant