diff --git a/backend/package.json b/backend/package.json index 4b8c022..a5eb0c5 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "rosterchirp-backend", - "version": "0.12.4", + "version": "0.12.5", "description": "RosterChirp backend server", "main": "src/index.js", "scripts": { diff --git a/build.sh b/build.sh index 94e60c6..b9ec2d3 100644 --- a/build.sh +++ b/build.sh @@ -13,7 +13,7 @@ # ───────────────────────────────────────────────────────────── set -euo pipefail -VERSION="${1:-0.12.4}" +VERSION="${1:-0.12.5}" ACTION="${2:-}" REGISTRY="${REGISTRY:-}" IMAGE_NAME="rosterchirp" diff --git a/frontend/package.json b/frontend/package.json index ef7a550..ec8203e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "rosterchirp-frontend", - "version": "0.12.4", + "version": "0.12.5", "private": true, "scripts": { "dev": "vite", diff --git a/frontend/public/manifest.json b/frontend/public/manifest.json index d395073..95177dd 100644 --- a/frontend/public/manifest.json +++ b/frontend/public/manifest.json @@ -8,6 +8,7 @@ "orientation": "any", "background_color": "#ffffff", "theme_color": "#1a73e8", + "gcm_sender_id": "126479377334", "icons": [ { "src": "/icons/icon-192.png", @@ -22,18 +23,11 @@ "purpose": "maskable" }, { - "purpose": "maskable", + "purpose": "any maskable", "src": "/icons/icon-512-maskable.png", "sizes": "512x512", "type": "image/png" - }, - { - "purpose": "any", - "src": "/icons/icon-512.png", - "sizes": "512x512", - "type": "image/png" - } ], "min_width": "320px" diff --git a/frontend/public/sw.js b/frontend/public/sw.js index b7dfe2f..74e0e2e 100644 --- a/frontend/public/sw.js +++ b/frontend/public/sw.js @@ -93,13 +93,37 @@ firebaseConfigPromise.then(() => { } }); -// ── Raw push event (fallback diagnostic) ───────────────────────────────────── -// Fires for every push event BEFORE the Firebase SDK handles it. -// Log it so chrome://inspect shows whether the SW is even waking up. +// ── Raw push event (fallback for Android) ───────────────────────────────────── +// Android Chrome sometimes doesn't properly trigger Firebase's onBackgroundMessage +// This fallback ensures notifications are displayed even if Firebase SDK fails self.addEventListener('push', (event) => { console.log('[SW] push event received, hasData:', !!event.data, 'text:', event.data?.text?.()?.slice(0, 120)); - // Note: Firebase compat SDK registers its own push listener and handles display. - // This listener is diagnostic only — do not call showNotification() here. + + // Try to handle the push event directly as a fallback + if (event.data) { + try { + const data = event.data.json(); + console.log('[SW] Push data parsed:', JSON.stringify(data)); + + // If this is a Firebase message with data payload, show notification + if (data.data || (data.title && data.body)) { + const notificationData = data.data || data; + return showRosterChirpNotification(notificationData); + } + } catch (e) { + console.warn('[SW] Failed to parse push data:', e); + // Try to show a basic notification with the raw text + const text = event.data.text(); + if (text) { + return self.registration.showNotification('RosterChirp', { + body: text.slice(0, 100), + icon: '/icons/icon-192.png', + badge: '/icons/icon-192-maskable.png', + tag: 'rosterchirp-fallback', + }); + } + } + } }); // ── Notification click ────────────────────────────────────────────────────────