v0.12.5 FCM bug fixes
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rosterchirp-backend",
|
"name": "rosterchirp-backend",
|
||||||
"version": "0.12.4",
|
"version": "0.12.5",
|
||||||
"description": "RosterChirp backend server",
|
"description": "RosterChirp backend server",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
2
build.sh
2
build.sh
@@ -13,7 +13,7 @@
|
|||||||
# ─────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
VERSION="${1:-0.12.4}"
|
VERSION="${1:-0.12.5}"
|
||||||
ACTION="${2:-}"
|
ACTION="${2:-}"
|
||||||
REGISTRY="${REGISTRY:-}"
|
REGISTRY="${REGISTRY:-}"
|
||||||
IMAGE_NAME="rosterchirp"
|
IMAGE_NAME="rosterchirp"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rosterchirp-frontend",
|
"name": "rosterchirp-frontend",
|
||||||
"version": "0.12.4",
|
"version": "0.12.5",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
"orientation": "any",
|
"orientation": "any",
|
||||||
"background_color": "#ffffff",
|
"background_color": "#ffffff",
|
||||||
"theme_color": "#1a73e8",
|
"theme_color": "#1a73e8",
|
||||||
|
"gcm_sender_id": "126479377334",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/icons/icon-192.png",
|
"src": "/icons/icon-192.png",
|
||||||
@@ -22,18 +23,11 @@
|
|||||||
"purpose": "maskable"
|
"purpose": "maskable"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"purpose": "maskable",
|
"purpose": "any maskable",
|
||||||
"src": "/icons/icon-512-maskable.png",
|
"src": "/icons/icon-512-maskable.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png"
|
"type": "image/png"
|
||||||
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"purpose": "any",
|
|
||||||
"src": "/icons/icon-512.png",
|
|
||||||
"sizes": "512x512",
|
|
||||||
"type": "image/png"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"min_width": "320px"
|
"min_width": "320px"
|
||||||
|
|||||||
@@ -93,13 +93,37 @@ firebaseConfigPromise.then(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Raw push event (fallback diagnostic) ─────────────────────────────────────
|
// ── Raw push event (fallback for Android) ─────────────────────────────────────
|
||||||
// Fires for every push event BEFORE the Firebase SDK handles it.
|
// Android Chrome sometimes doesn't properly trigger Firebase's onBackgroundMessage
|
||||||
// Log it so chrome://inspect shows whether the SW is even waking up.
|
// This fallback ensures notifications are displayed even if Firebase SDK fails
|
||||||
self.addEventListener('push', (event) => {
|
self.addEventListener('push', (event) => {
|
||||||
console.log('[SW] push event received, hasData:', !!event.data, 'text:', event.data?.text?.()?.slice(0, 120));
|
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 ────────────────────────────────────────────────────────
|
// ── Notification click ────────────────────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user