mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FEATURE: Enable service worker on iOS PWA
This commit is contained in:
parent
5889309d3b
commit
d05142d3f7
1 changed files with 5 additions and 2 deletions
|
@ -10,9 +10,12 @@ export default {
|
|||
|
||||
if (isSupported) {
|
||||
const caps = Discourse.__container__.lookup("capabilities:main");
|
||||
const isApple = caps.isSafari || caps.isIOS || caps.isIpadOS;
|
||||
const isAppleBrowser =
|
||||
caps.isSafari ||
|
||||
(caps.isIOS &&
|
||||
!window.matchMedia("(display-mode: standalone)").matches);
|
||||
|
||||
if (Discourse.ServiceWorkerURL && !isApple) {
|
||||
if (Discourse.ServiceWorkerURL && !isAppleBrowser) {
|
||||
navigator.serviceWorker.getRegistrations().then(registrations => {
|
||||
for (let registration of registrations) {
|
||||
if (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue