diff --git a/app/Http/Controllers/Customer/PWAController.php b/app/Http/Controllers/Customer/PWAController.php
new file mode 100644
index 0000000..c5e6bf4
--- /dev/null
+++ b/app/Http/Controllers/Customer/PWAController.php
@@ -0,0 +1,91 @@
+ "icon-192.png",
+ "sizes" => "192x192",
+ "type" => "image/png",
+ "purpose" => "any"
+ ],
+ [
+ "src" => "icon-192-maskable.png",
+ "sizes" => "192x192",
+ "type" => "image/png",
+ "purpose" => "maskable"
+ ],
+ [
+ "src" => "icon-512.png",
+ "sizes" => "512x512",
+ "type" => "image/png",
+ "purpose" => "any"
+ ],
+ [
+ "src" => "icon-512-maskable.png",
+ "sizes" => "512x512",
+ "type" => "image/png",
+ "purpose" => "maskable"
+ ],
+ ];
+
+ $data = [
+ "name" => "WBB Voucher App",
+ "short_name" => "Voucher App",
+ "start_url" => '/?direct=1',
+ "id" => 'id.ajikamaludin.voucher',
+ "scope" => ".",
+ "display" => "standalone",
+ "background_color" => "#0940c4",
+ "theme_color" => "#db1f1f",
+ "description" => "Aplikasi Voucher WiFi",
+ "orientation" => "portrait",
+ "icons" => $icons,
+ "prefer_related_applications" => false,
+ "display_override" => [
+ "standalone",
+ "fullscreen",
+ "window-controls-overlay"
+ ],
+ "screenshots" => [
+ [
+ "src" => "screenshot_1.png",
+ "sizes" => "1280x800",
+ "type" => "image/png"
+ ],
+ [
+ "src" => "screenshot_2.png",
+ "sizes" => "750x1334",
+ "type" => "image/png"
+ ]
+ ],
+ "categories" => [
+ "productivity",
+ "utilities"
+ ],
+ "dir" => "ltr"
+ ];
+
+ return response()->json($data);
+ }
+
+ public function assetlinks()
+ {
+ return response()->json([[
+ "relation" => ["delegate_permission/common.handle_all_urls"],
+ "target" => [
+ "namespace" => "android_app",
+ "package_name" => "id.my.itworks.voucher.twa",
+ "sha256_cert_fingerprints" => ["58:1C:40:FB:F0:E5:E9:F5:A3:87:13:6D:22:08:3B:A5:68:4E:8F:63:E3:CA:52:70:8F:8A:24:7E:9F:D2:2C:75"]
+ ]
+ ]]);
+ }
+}
diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png
new file mode 100644
index 0000000..a466242
Binary files /dev/null and b/public/apple-touch-icon.png differ
diff --git a/public/favicon.ico b/public/favicon.ico
index fd55374..42d7fae 100644
Binary files a/public/favicon.ico and b/public/favicon.ico differ
diff --git a/public/icon-192-maskable.png b/public/icon-192-maskable.png
new file mode 100644
index 0000000..c57f411
Binary files /dev/null and b/public/icon-192-maskable.png differ
diff --git a/public/icon-192.png b/public/icon-192.png
new file mode 100644
index 0000000..3801392
Binary files /dev/null and b/public/icon-192.png differ
diff --git a/public/icon-512-maskable.png b/public/icon-512-maskable.png
new file mode 100644
index 0000000..ebbef8b
Binary files /dev/null and b/public/icon-512-maskable.png differ
diff --git a/public/icon-512.png b/public/icon-512.png
new file mode 100644
index 0000000..1bdf48f
Binary files /dev/null and b/public/icon-512.png differ
diff --git a/public/offline.html b/public/offline.html
new file mode 100644
index 0000000..b2a5e3d
--- /dev/null
+++ b/public/offline.html
@@ -0,0 +1,346 @@
+
+
+
+
+
+
+ Offline
+
+
+
+
+
+
+ Ada kendala jaringan
+
+
diff --git a/public/screenshot.png b/public/screenshot.png
new file mode 100644
index 0000000..0e9cc77
Binary files /dev/null and b/public/screenshot.png differ
diff --git a/public/screenshot_1.png b/public/screenshot_1.png
new file mode 100644
index 0000000..23b327b
Binary files /dev/null and b/public/screenshot_1.png differ
diff --git a/public/screenshot_2.png b/public/screenshot_2.png
new file mode 100644
index 0000000..56584d5
Binary files /dev/null and b/public/screenshot_2.png differ
diff --git a/public/sw.js b/public/sw.js
new file mode 100644
index 0000000..e90ee36
--- /dev/null
+++ b/public/sw.js
@@ -0,0 +1,51 @@
+// This is the "Offline page" service worker
+
+importScripts(
+ 'https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js'
+)
+const offlineFallbackPage = 'offline.html'
+
+const PRECACHE_ASSETS = [offlineFallbackPage]
+
+const CACHE = 'voucher-app'
+
+self.addEventListener('message', (event) => {
+ if (event.data && event.data.type === 'SKIP_WAITING') {
+ self.skipWaiting()
+ }
+})
+
+self.addEventListener('install', async (event) => {
+ event.waitUntil(
+ caches.open(CACHE).then((cache) => {
+ cache.addAll(PRECACHE_ASSETS)
+ })
+ )
+})
+
+if (workbox.navigationPreload.isSupported()) {
+ workbox.navigationPreload.enable()
+}
+
+self.addEventListener('fetch', (event) => {
+ if (event.request.mode === 'navigate') {
+ event.respondWith(
+ (async () => {
+ try {
+ const preloadResp = await event.preloadResponse
+
+ if (preloadResp) {
+ return preloadResp
+ }
+
+ const networkResp = await fetch(event.request)
+ return networkResp
+ } catch (error) {
+ const cache = await caches.open(CACHE)
+ const cachedResp = await cache.match(offlineFallbackPage)
+ return cachedResp
+ }
+ })()
+ )
+ }
+})
diff --git a/resources/views/app.blade.php b/resources/views/app.blade.php
index 43b6a87..00620dc 100644
--- a/resources/views/app.blade.php
+++ b/resources/views/app.blade.php
@@ -6,6 +6,12 @@
+
+
+
+
+
+
{{ config('app.name', 'Voucher') }}
@@ -17,6 +23,12 @@
@viteReactRefresh
@vite(['resources/js/app.jsx', "resources/js/Customer/{$page['component']}.jsx"])
@inertiaHead
+
+
@inertia
diff --git a/routes/web.php b/routes/web.php
index 316f8c1..2d16c19 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -10,6 +10,7 @@ use App\Http\Controllers\Customer\PaylaterController;
use App\Http\Controllers\Customer\PoinController;
use App\Http\Controllers\Customer\PoinExchangeController;
use App\Http\Controllers\Customer\ProfileController;
+use App\Http\Controllers\Customer\PWAController;
use App\Http\Controllers\Customer\TransactionController;
use App\Http\Controllers\Customer\VerificationController;
use Illuminate\Support\Facades\Route;
@@ -25,7 +26,10 @@ use Illuminate\Support\Facades\Route;
|
*/
+Route::view('/offline.html', 'offline');
+
Route::middleware(['http_secure_aware', 'guard_should_customer', 'inertia.customer'])->group(function () {
+ Route::get('/index.html', [HomeController::class, 'index'])->name('home.index');
Route::get('/', [HomeController::class, 'index'])->name('home.index');
Route::get('/banner/{banner}', [HomeController::class, 'banner'])->name('home.banner');
@@ -105,4 +109,8 @@ Route::middleware(['http_secure_aware', 'guard_should_customer', 'inertia.custom
});
});
+// PWA Suppoer
+Route::get('/manifest.json', [PWAController::class, 'manifest']);
+Route::get('/.well-known/assetlinks.json', [PWAController::class, 'assetlinks']);
+
require_once 'admin.php';