Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.1] - 2026-10-27

### Security

- `ButtonPressed`, `ToastAction` and `InputSubmitted` implement `Native\Mobile\Events\Contracts\DispatchableFromNative`, which the `/_native/api/events` endpoint requires since NativePHP Mobile 3.3.11 and 4.6.1 ([GHSA-83jv-8h7x-287p](https://github.com/NativePHP/mobile-air/security/advisories/GHSA-83jv-8h7x-287p)). Without it, Laravel listeners for these events stop receiving them on patched NativePHP versions.

### Changed

- Requires `nativephp/mobile` `^3.3.11|^4.6.1`. Older 3.x versions lack the marker interface and are affected by the advisories above.
- Custom event classes passed to `->event()` must implement `DispatchableFromNative` to reach Laravel listeners.

## [1.0.0] - 2026-03-01

### Added
Expand All @@ -27,4 +38,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Android: min SDK 24, uses `com.google.android.material:material:1.12.0`
- iOS: min version 15.0, no external dependencies

[1.0.1]: https://github.com/mazer-dev/nativephp-dialogify/releases/tag/1.0.1
[1.0.0]: https://github.com/mazer-dev/nativephp-dialogify/releases/tag/v1.0.0
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ A complete native communication hub for your NativePHP Mobile app -- toast notif
## Requirements

- PHP >= 8.2
- NativePHP Mobile ^3.0
- NativePHP Mobile ^3.3.11 or ^4.6.1
- Android min SDK 24
- iOS >= 15.0

Expand Down Expand Up @@ -329,6 +329,24 @@ Dialogify::alert('Edit Profile')
// Your custom event class receives the same payload
```

The custom event class must implement `Native\Mobile\Events\Contracts\DispatchableFromNative`. Since NativePHP Mobile 3.3.11 and 4.6.1, the `/_native/api/events` endpoint refuses any class without this marker ([GHSA-83jv-8h7x-287p](https://github.com/NativePHP/mobile-air/security/advisories/GHSA-83jv-8h7x-287p)), so Laravel listeners registered with `Event::listen` never receive it. Livewire `#[OnNative]` handlers still receive the event, because the web view dispatches it to Livewire directly.

```php
use Native\Mobile\Events\Contracts\DispatchableFromNative;

class ProfileUpdated implements DispatchableFromNative
{
public function __construct(
public string $buttonId,
public string $label,
public ?string $dialogId = null,
public array $inputs = [],
) {}
}
```

The built-in `ButtonPressed`, `ToastAction` and `InputSubmitted` events already implement the marker.

---

## JavaScript Usage
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "proprietary",
"require": {
"php": "^8.3",
"nativephp/mobile": "^3.0"
"nativephp/mobile": "^3.3.11|^4.6.1"
},
"require-dev": {
"laravel/pint": "^1.27",
Expand Down
3 changes: 2 additions & 1 deletion src/Events/ButtonPressed.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
use Native\Mobile\Events\Contracts\DispatchableFromNative;

class ButtonPressed
class ButtonPressed implements DispatchableFromNative
{
use Dispatchable, SerializesModels;

Expand Down
3 changes: 2 additions & 1 deletion src/Events/InputSubmitted.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
use Native\Mobile\Events\Contracts\DispatchableFromNative;

class InputSubmitted
class InputSubmitted implements DispatchableFromNative
{
use Dispatchable, SerializesModels;

Expand Down
3 changes: 2 additions & 1 deletion src/Events/ToastAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
use Native\Mobile\Events\Contracts\DispatchableFromNative;

class ToastAction
class ToastAction implements DispatchableFromNative
{
use Dispatchable, SerializesModels;

Expand Down
5 changes: 5 additions & 0 deletions tests/Unit/EventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use MazerDev\Dialogify\Events\ButtonPressed;
use MazerDev\Dialogify\Events\InputSubmitted;
use MazerDev\Dialogify\Events\ToastAction;
use Native\Mobile\Events\Contracts\DispatchableFromNative;

test('ButtonPressed event stores properties', function () {
$event = new ButtonPressed(
Expand Down Expand Up @@ -55,3 +56,7 @@

expect($event->inputs)->toBe([]);
});

test('events can be dispatched from native', function (string $event) {
expect(is_subclass_of($event, DispatchableFromNative::class))->toBeTrue();
})->with([ButtonPressed::class, ToastAction::class, InputSubmitted::class]);
Loading