<?php
declare(strict_types=1);
namespace App\Controller\Frontend\DeepLink;
use App\Web\DeepLink\Infrastructure\DeepLinkMobileAssociationConfiguration;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;
final class DeepLinkAssociationController
{
/** @Route("/.well-known/assetlinks.json", name="deep_link_assetlinks", methods={"GET"}) */
public function assetLinks(DeepLinkMobileAssociationConfiguration $configuration): JsonResponse
{
return $this->response($configuration->androidAssetLinks());
}
/** @Route("/.well-known/apple-app-site-association", name="deep_link_apple_app_site_association", methods={"GET"}) */
public function appleAppSiteAssociation(DeepLinkMobileAssociationConfiguration $configuration): JsonResponse
{
return $this->response($configuration->appleAppSiteAssociation());
}
/** @param array<string,mixed>|array<int,array<string,mixed>> $data */
private function response(array $data): JsonResponse
{
$response = new JsonResponse($data);
$response->headers->set('Content-Type', 'application/json');
$response->headers->set('Cache-Control', 'public, max-age=3600');
return $response;
}
}