Skip to content

Commit

Permalink
PWA bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SindlaXYZ committed Jan 5, 2021
1 parent 5412e58 commit 544243b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Utils/PWA/PWA.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function browserConfig(Request $Request)
public function mainJS(Request $Request)
{
$rendered = $this->twig->render('@Aurora/pwa-main.js.twig', [
'pwaVersion' => $this->version(),
'pwaVersion' => $this->version($Request),
'automatically_prompt' => ($this->container->hasParameter('aurora.pwa.automatically_prompt') ? boolval($this->container->getParameter('aurora.pwa.automatically_prompt')) : true)
]);

Expand All @@ -163,7 +163,7 @@ public function mainJS(Request $Request)
public function serviceWorkerJS(Request $Request)
{
$rendered = $this->twig->render('@Aurora/pwa-sw.js.twig', [
'pwaVersion' => $this->version(),
'pwaVersion' => $this->version($Request),
'precache' => "'" . implode("', '", array_unique(array_merge([$this->container->getParameter('aurora.pwa.start_url'), $this->container->getParameter('aurora.pwa.offline')], $this->container->getParameter('aurora.pwa.precache')))) . "'",
'prevent_cache' => "'" . implode("', '", $this->container->getParameter('aurora.pwa.prevent_cache')) . "'",
'external_cache' => "/" . implode("/, /", $this->container->getParameter('aurora.pwa.external_cache')) . "/",
Expand Down
10 changes: 5 additions & 5 deletions src/Utils/Twig/UtilityExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,17 @@ public function pwa(Request $Request, bool $debug)
'pwa' => (bool)($Request->isSecure() || preg_match('/(.*\.localhost$|^localhost$)/i', $Request->getHost())),
'theme_color' => $this->container->getParameter('aurora.pwa.theme_color'),
'build' => $this->getBuild(),
'pwaVersion' => $this->pwaVersion(),
'pwaVersion' => $this->pwaVersion($Request),
'debug' => $debug
]);
}

public function pwaVersion()
public function pwaVersion(Request $Request)
{
/** @var PWA $PWA */
$PWA = $this->container->get('aurora.pwa');

return $PWA->version();
return $PWA->version($Request);
}

public function pwaDelete(Request $Request, bool $debug)
Expand All @@ -176,7 +176,7 @@ public function pwaDelete(Request $Request, bool $debug)
'host' => $Request->getHost(),
'pwa' => (bool)($Request->isSecure() || preg_match('/(.*\.localhost$|^localhost$)/i', $Request->getHost())),
'build' => $this->getBuild(),
'pwaVersion' => $this->pwaVersion(),
'pwaVersion' => $this->pwaVersion($Request),
'debug' => $debug
]);
}
Expand All @@ -187,7 +187,7 @@ public function pwaUnregister(Request $Request, bool $debug)
'host' => $Request->getHost(),
'pwa' => (bool)($Request->isSecure() || preg_match('/(.*\.localhost$|^localhost$)/i', $Request->getHost())),
'build' => $this->getBuild(),
'pwaVersion' => $this->pwaVersion(),
'pwaVersion' => $this->pwaVersion($Request),
'debug' => $debug
]);
}
Expand Down

0 comments on commit 544243b

Please sign in to comment.