feat: add persistent mobile notifications
CI / 🧪 Tests Laravel (push) Successful in 2m7s
CI / 🐳 Build & Push Image (push) Successful in 42s

This commit is contained in:
2026-08-11 16:46:05 +02:00
parent bd1b4bba20
commit df4f523089
24 changed files with 822 additions and 75 deletions
@@ -4,25 +4,21 @@ namespace App\Notifications;
use App\Models\PostReviews;
use App\Services\MobileDeepLink;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Str;
class MealPostCommentedNotification extends Notification
class MealPostCommentedNotification extends MobileNotification
{
use Queueable;
public function __construct(private readonly PostReviews $postReview) {}
/**
* @return array<int, string>
*/
public function via(object $notifiable): array
public function __construct(private readonly PostReviews $postReview)
{
return ['expo'];
parent::__construct();
}
public function toExpoPush(object $notifiable): array
protected function category(): string
{
return self::CATEGORY_SOCIAL;
}
protected function payload(object $notifiable): array
{
$this->postReview->loadMissing(
'mealPost:id,title,user_id',
@@ -35,16 +31,13 @@ class MealPostCommentedNotification extends Notification
$commenterName = $this->postReview->user?->name ?: __('api.notifications.someone');
return [
'type' => 'meal_commented',
'title' => __('api.notifications.meal_post_commented_title'),
'body' => __('api.notifications.meal_post_commented_body', [
'meal' => $mealTitle,
'name' => $commenterName,
]),
'sound' => 'default',
'channelId' => 'default',
'data' => [
'url' => MobileDeepLink::to("meals/{$mealPostId}"),
],
'url' => MobileDeepLink::to("meals/{$mealPostId}"),
];
}
}