*/ public static function messageKeys(): array { return self::MESSAGE_KEYS; } /** * Get the notification's delivery channels. * * @return array */ public function via(object $notifiable): array { return ['expo']; } /** * @return array{ * title: string, * body: string, * sound: string, * channelId: string, * data: array{type: string, message_key: string, url: string} * } */ public function toExpoPush(object $notifiable): array { $message = $this->message(); return [ 'title' => $message['title'], 'body' => $message['body'], 'sound' => 'default', 'channelId' => 'default', 'data' => [ 'type' => 'engagement_reminder', 'message_key' => $this->messageKey, 'url' => MobileDeepLink::to($this->path()), ], ]; } /** * @return array{title: string, body: string} */ private function message(): array { $message = trans("api.notifications.engagement_reminders.{$this->messageKey}"); if (is_array($message)) { return $message; } $fallback = trans('api.notifications.engagement_reminders.publish_meal'); return is_array($fallback) ? $fallback : [ 'title' => 'Bowli', 'body' => 'Publie ton plat du jour quand tu as un moment.', ]; } private function path(): string { return $this->messageKey === 'workout_checkin' ? 'profile/workouts?create=1' : 'create'; } }