Spaces:
No application file
No application file
File size: 1,540 Bytes
d2897cd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
<?php
namespace Mautic\NotificationBundle\Controller;
use Mautic\CoreBundle\Controller\CommonController;
use Symfony\Component\HttpFoundation\Response;
class JsController extends CommonController
{
/**
* We can't user JsonResponse here, because
* it improperly encodes the data array.
*/
public function manifestAction(): Response
{
$gcmSenderId = $this->coreParametersHelper->get('gcm_sender_id', '446150739532');
$data = [
'start_url' => '/',
'gcm_sender_id' => $gcmSenderId,
'gcm_user_visible_only' => true,
];
return new Response(
json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES),
200,
[
'Content-Type' => 'application/json',
]
);
}
public function workerAction(): Response
{
return new Response(
"importScripts('https://cdn.onesignal.com/sdks/OneSignalSDK.js');",
200,
[
'Service-Worker-Allowed' => '/',
'Content-Type' => 'application/javascript',
]
);
}
public function updaterAction(): Response
{
return new Response(
"importScripts('https://cdn.onesignal.com/sdks/OneSignalSDK.js');",
200,
[
'Service-Worker-Allowed' => '/',
'Content-Type' => 'application/javascript',
]
);
}
}
|