]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7034 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 1 Aug 2024 16:17:04 +0000 (18:17 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 1 Aug 2024 16:17:04 +0000 (18:17 +0200)
app/Fluidbook/Compiler/Compiler.php
app/Fluidbook/Compiler/PWA.php [new file with mode: 0644]

index d3b46fdac89980f3bc12bac80a05db79140eeafc..6e0e71847ca89127d7ba09f99727b0918a4dea87 100644 (file)
@@ -53,6 +53,7 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError
     use Tabs;
     use PDF;
     use Screensaver;
+    use PWA;
 
     /** @var Lock */
     protected $lock;
@@ -752,6 +753,8 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError
                 $this->log('Search written');
                 $this->writeAccessibility();
                 $this->log('Accessibility written');
+                $this->writePWA();
+                $this->log('PWA written');
                 $this->writeExtras();
                 $this->log('Extras written');
                 $this->populateConfig();
@@ -1131,8 +1134,10 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError
 </script>';
             }
 
+            $pwa = $this->getPWAMarkup();
+
             $this->log('Got index vars 5');
-            $vars = array('lang', 'titre', 'credits', 'style', 'script', 'pagesContents', 'print', 'splash', 'splashstyles', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard', 'description', 'console');
+            $vars = array('lang', 'titre', 'credits', 'style', 'script', 'pagesContents', 'print', 'splash', 'splashstyles', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard', 'description', 'console', 'pwa');
 
             $res = [];
             foreach ($vars as $v) {
diff --git a/app/Fluidbook/Compiler/PWA.php b/app/Fluidbook/Compiler/PWA.php
new file mode 100644 (file)
index 0000000..946a935
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+namespace App\Fluidbook\Compiler;
+
+trait PWA
+{
+    protected function writePWA()
+    {
+
+    }
+
+    protected function getPWAMarkup()
+    {
+        $res = '';
+        if ($this->config->pwa_ios) {
+            $res .= '<meta name="apple-mobile-web-app-title" content="' . e($this->config->pwa_ios_title ?? $this->config->title) . '">
+    <meta name="apple-mobile-web-app-capable" content="yes">
+    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">';
+        }
+        return $res;
+    }
+}