Skip to content

Commit

Permalink
Merge pull request #158 from Spomky-Labs/temp-465fb9
Browse files Browse the repository at this point in the history
Merge up 1.1.3 to 1.2.x
  • Loading branch information
Spomky authored Apr 4, 2024
2 parents a30813f + bf6b4cf commit efca49d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/CachingStrategy/GoogleFontCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
),
];
Expand Down
6 changes: 1 addition & 5 deletions src/Twig/PwaRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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%')]
Expand Down Expand Up @@ -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 = <<<SERVICE_WORKER
<script type="module" {$scriptAttributes}>
import {Workbox} from '{$workboxUrl}';
Expand Down

0 comments on commit efca49d

Please sign in to comment.