diff --git a/src/CachingStrategy/GoogleFontCache.php b/src/CachingStrategy/GoogleFontCache.php index c521095..d29f36a 100644 --- a/src/CachingStrategy/GoogleFontCache.php +++ b/src/CachingStrategy/GoogleFontCache.php @@ -44,8 +44,8 @@ public function getCacheStrategies(): array ->withPlugin( CacheableResponsePlugin::create(), ExpirationPlugin::create( - $this->workbox->googleFontCache->maxAgeInSeconds() ?? 60 * 60 * 24 * 365, - $this->workbox->googleFontCache->maxEntries ?? 30 + $this->workbox->googleFontCache->maxEntries ?? 30, + $this->workbox->googleFontCache->maxAgeInSeconds() ?? 60 * 60 * 24 * 365 ), ), ]; diff --git a/src/Twig/PwaRuntime.php b/src/Twig/PwaRuntime.php index dc9d4de..e55388c 100644 --- a/src/Twig/PwaRuntime.php +++ b/src/Twig/PwaRuntime.php @@ -8,7 +8,6 @@ use SpomkyLabs\PwaBundle\Dto\Icon; use SpomkyLabs\PwaBundle\Dto\Manifest; use Symfony\Component\AssetMapper\AssetMapperInterface; -use Symfony\Component\AssetMapper\ImportMap\ImportMapConfigReader; use Symfony\Component\AssetMapper\MappedAsset; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Mime\MimeTypes; @@ -25,8 +24,6 @@ public function __construct( private bool $manifestEnabled, #[Autowire('%spomky_labs_pwa.sw.enabled%')] private bool $serviceWorkerEnabled, - #[Autowire('@asset_mapper.importmap.config_reader')] - private ImportMapConfigReader $importMapConfigReader, private AssetMapperInterface $assetMapper, private Manifest $manifest, #[Autowire('%spomky_labs_pwa.manifest.public_url%')] @@ -94,8 +91,7 @@ private function injectServiceWorker(string $output, bool $injectSW, array $swAt $registerOptions = sprintf(', {%s}', mb_substr($registerOptions, 2)); } if ($serviceWorker->workbox->enabled === true) { - $hasWorkboxWindow = $this->importMapConfigReader->findRootImportMapEntry('workbox-window') !== null; - $workboxUrl = $hasWorkboxWindow ? 'workbox-window' : 'https://storage.googleapis.com/workbox-cdn/releases/7.0.0/workbox-window.prod.mjs'; + $workboxUrl = sprintf('%s%s', $serviceWorker->workbox->workboxPublicUrl, '/workbox-window.prod.mjs'); $declaration = << import {Workbox} from '{$workboxUrl}';