diff --git a/composer.json b/composer.json index 7c65bd6b2..58105e823 100755 --- a/composer.json +++ b/composer.json @@ -28,7 +28,6 @@ "maatwebsite/excel": "^3.1", "pusher/pusher-php-server": "7.0.2", "rappasoft/laravel-livewire-tables": "^3.2", - "silviolleite/laravelpwa": "^2.0", "spatie/laravel-collection-macros": "^7.12.3", "spatie/laravel-permission": "^5.9.1", "spatie/laravel-short-schedule": "^1.5" diff --git a/composer.lock b/composer.lock index 18d9e1f20..a3415e3be 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "afe646774652872e716e2d5220a53f12", + "content-hash": "c481eabb7ab93170a15ec8ca73d86ebd", "packages": [ { "name": "beyondcode/laravel-websockets", @@ -6497,56 +6497,6 @@ ], "time": "2024-06-11T12:45:25+00:00" }, - { - "name": "silviolleite/laravelpwa", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/silviolleite/laravel-pwa.git", - "reference": "5f7135d2ee870af01793c9fdf6b1b932b546e20e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/silviolleite/laravel-pwa/zipball/5f7135d2ee870af01793c9fdf6b1b932b546e20e", - "reference": "5f7135d2ee870af01793c9fdf6b1b932b546e20e", - "shasum": "" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "LaravelPWA\\Providers\\LaravelPWAServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "LaravelPWA\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Silvio Luis Leite", - "email": "silviolleite@gmail.com" - } - ], - "description": "Looks like an app, feels like an app, but NOT an app.", - "keywords": [ - "laravel", - "php", - "progressive web apps", - "pwa" - ], - "support": { - "issues": "https://github.com/silviolleite/laravel-pwa/issues", - "source": "https://github.com/silviolleite/laravel-pwa/tree/2.0.3" - }, - "time": "2020-08-20T12:19:16+00:00" - }, { "name": "spatie/laravel-collection-macros", "version": "7.14.1", @@ -12234,16 +12184,16 @@ }, { "name": "spatie/flare-client-php", - "version": "1.7.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/spatie/flare-client-php.git", - "reference": "097040ff51e660e0f6fc863684ac4b02c93fa234" + "reference": "180f8ca4c0d0d6fc51477bd8c53ce37ab5a96122" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/097040ff51e660e0f6fc863684ac4b02c93fa234", - "reference": "097040ff51e660e0f6fc863684ac4b02c93fa234", + "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/180f8ca4c0d0d6fc51477bd8c53ce37ab5a96122", + "reference": "180f8ca4c0d0d6fc51477bd8c53ce37ab5a96122", "shasum": "" }, "require": { @@ -12261,7 +12211,7 @@ "phpstan/extension-installer": "^1.1", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", - "spatie/phpunit-snapshot-assertions": "^4.0|^5.0" + "spatie/pest-plugin-snapshots": "^1.0|^2.0" }, "type": "library", "extra": { @@ -12291,7 +12241,7 @@ ], "support": { "issues": "https://github.com/spatie/flare-client-php/issues", - "source": "https://github.com/spatie/flare-client-php/tree/1.7.0" + "source": "https://github.com/spatie/flare-client-php/tree/1.8.0" }, "funding": [ { @@ -12299,7 +12249,7 @@ "type": "github" } ], - "time": "2024-06-12T14:39:14+00:00" + "time": "2024-08-01T08:27:26+00:00" }, { "name": "spatie/ignition", diff --git a/config/laravelpwa.php b/config/laravelpwa.php deleted file mode 100644 index de5c70a8f..000000000 --- a/config/laravelpwa.php +++ /dev/null @@ -1,64 +0,0 @@ - 'LaravelPWA', - 'manifest' => [ - 'name' => env('APP_NAME', 'Planes of Tlessa'), - 'short_name' => 'PoT', - 'start_url' => '/', - 'background_color' => '#ffffff', - 'theme_color' => '#000000', - 'display' => 'standalone', - 'orientation'=> 'any', - 'status_bar'=> 'black', - 'icons' => [ - '72x72' => [ - 'path' => 'pwa-images/tlessa-icons/tlessa-icon-72.png', - 'purpose' => 'any' - ], - '96x96' => [ - 'path' => 'pwa-images/tlessa-icons/tlessa-icon-96.png', - 'purpose' => 'any' - ], - '128x128' => [ - 'path' => 'pwa-images/tlessa-icons/tlessa-icon-128.png', - 'purpose' => 'any' - ], - '144x144' => [ - 'path' => 'pwa-images/tlessa-icons/tlessa-icon-144.png', - 'purpose' => 'any' - ], - '152x152' => [ - 'path' => 'pwa-images/tlessa-icons/tlessa-icon-152.png', - 'purpose' => 'any' - ], - '192x192' => [ - 'path' => 'pwa-images/tlessa-icons/tlessa-icon-192.png', - 'purpose' => 'any' - ], - '384x384' => [ - 'path' => 'pwa-images/tlessa-icons/tlessa-icon-384.png', - 'purpose' => 'any' - ], - '512x512' => [ - 'path' => 'pwa-images/tlessa-icons/tlessa-icon-512.png', - 'purpose' => 'any' - ], - ], - 'splash' => [ - '640x1136' => 'pwa-images/tlessa-splash-images/tlessa-splash-640x1136.png', - '750x1334' => 'pwa-images/tlessa-splash-images/tlessa-splash-750x1334.png', - '828x1792' => 'pwa-images/tlessa-splash-images/tlessa-splash-828x1792.png', - '1125x2436' => 'pwa-images/tlessa-splash-images/tlessa-splash-1125x2436.png', - '1242x2208' => 'pwa-images/tlessa-splash-images/tlessa-splash-1242x2208.png', - '1242x2688' => 'pwa-images/tlessa-splash-images/tlessa-splash-1242x2688.png', - '1536x2048' => 'pwa-images/tlessa-splash-images/tlessa-splash-1536x2048.png', - '1668x2224' => 'pwa-images/tlessa-splash-images/tlessa-splash-1668x2224.png', - '1668x2388' => 'pwa-images/tlessa-splash-images/tlessa-splash-1668x2388.png', - '2048x2732' => 'pwa-images/tlessa-splash-images/tlessa-splash-2048x2732.png', - ], - 'shortcuts' => [ - ], - 'custom' => [] - ] -]; diff --git a/config/mjml.php b/config/mjml.php deleted file mode 100755 index 476a58766..000000000 --- a/config/mjml.php +++ /dev/null @@ -1,17 +0,0 @@ - true, - /* - * The path to the MJML binary - */ - // 'path_to_binary' => '', -]; diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 000000000..c9421581d --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,60 @@ +{ + "name": "Planes Of Tlessa", + "short_name": "PoT", + "start_url": "/", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff", + "orientation": "any", + "status_bar": "black", + "icons": [ + { + "src": "pwa-images/tlessa-icons/tlessa-icon-72.png", + "type": "image/png", + "sizes": "72x72", + "purpose": "any" + }, + { + "src": "pwa-images/tlessa-icons/tlessa-icon-96.png", + "type": "image/png", + "sizes": "96x96", + "purpose": "any" + }, + { + "src": "pwa-images/tlessa-icons/tlessa-icon-128.png", + "type": "image/png", + "sizes": "128x128", + "purpose": "any" + }, + { + "src": "pwa-images/tlessa-icons/tlessa-icon-144.png", + "type": "image/png", + "sizes": "144x144", + "purpose": "any" + }, + { + "src": "pwa-images/tlessa-icons/tlessa-icon-152.png", + "type": "image/png", + "sizes": "152x152", + "purpose": "any" + }, + { + "src": "pwa-images/tlessa-icons/tlessa-icon-192.png", + "type": "image/png", + "sizes": "192x192", + "purpose": "any" + }, + { + "src": "pwa-images/tlessa-icons/tlessa-icon-384.png", + "type": "image/png", + "sizes": "384x384", + "purpose": "any" + }, + { + "src": "pwa-images/tlessa-icons/tlessa-icon-512.png", + "type": "image/png", + "sizes": "512x512", + "purpose": "any" + } + ] +} diff --git a/public/serviceworker.js b/public/serviceworker.js index 458bea992..9c5ff7051 100644 --- a/public/serviceworker.js +++ b/public/serviceworker.js @@ -1,52 +1,53 @@ -var staticCacheName = "pwa-v" + new Date().getTime(); -var filesToCache = [ - '/offline', +const CACHE_NAME = 'planes-of-tlessa-cache-v1'; +const urlsToCache = [ + '/', '/css/app.css', '/js/app.js', - '/images/icons/icon-72x72.png', - '/images/icons/icon-96x96.png', - '/images/icons/icon-128x128.png', - '/images/icons/icon-144x144.png', - '/images/icons/icon-152x152.png', - '/images/icons/icon-192x192.png', - '/images/icons/icon-384x384.png', - '/images/icons/icon-512x512.png', + // Add more URLs to cache ]; -// Cache on install -self.addEventListener("install", event => { - this.skipWaiting(); +self.addEventListener('install', event => { event.waitUntil( - caches.open(staticCacheName) + caches.open(CACHE_NAME) .then(cache => { - return cache.addAll(filesToCache); + return cache.addAll(urlsToCache); }) - ) + ); +}); + +self.addEventListener('fetch', event => { + event.respondWith( + caches.match(event.request) + .then(response => { + if (response) { + return response; + } + return fetch(event.request).then(response => { + if (!response || response.status !== 200 || response.type !== 'basic') { + return response; + } + const responseToCache = response.clone(); + caches.open(CACHE_NAME) + .then(cache => { + cache.put(event.request, responseToCache); + }); + return response; + }); + }) + ); }); -// Clear cache on activate self.addEventListener('activate', event => { + const cacheWhitelist = [CACHE_NAME]; event.waitUntil( caches.keys().then(cacheNames => { return Promise.all( - cacheNames - .filter(cacheName => (cacheName.startsWith("pwa-"))) - .filter(cacheName => (cacheName !== staticCacheName)) - .map(cacheName => caches.delete(cacheName)) + cacheNames.map(cacheName => { + if (!cacheWhitelist.includes(cacheName)) { + return caches.delete(cacheName); + } + }) ); }) ); }); - -// Serve from Cache -self.addEventListener("fetch", event => { - event.respondWith( - caches.match(event.request) - .then(response => { - return response || fetch(event.request); - }) - .catch(() => { - return caches.match('offline'); - }) - ) -}); \ No newline at end of file diff --git a/resources/views/components/core/pwa-meta-tags/meta-tags.blade.php b/resources/views/components/core/pwa-meta-tags/meta-tags.blade.php new file mode 100644 index 000000000..ee3b5bfe0 --- /dev/null +++ b/resources/views/components/core/pwa-meta-tags/meta-tags.blade.php @@ -0,0 +1,54 @@ +@props(['title' => config('app.name', 'PlanesOfTlessa')]) + +