"Push-notification-diagnostics-enhancement"

This commit is contained in:
sysadmin
2025-09-30 17:48:23 +01:00
parent 8b4cb6e78c
commit 021cfc4edc
2 changed files with 129 additions and 5 deletions

View File

@@ -113,6 +113,30 @@ class AdminNotificationManager {
// Complete setup
await this.setupOrderNotifications();
} catch (error) {
console.error('Failed to enable notifications:', error);
// Show enhanced error message with diagnostics
let errorMessage = '❌ Failed to enable push notifications.\n\n';
if (error.message.includes('timed out') && error.message.includes('FCM')) {
errorMessage += '🔗 Network Issue Detected:\n';
errorMessage += 'Your browser cannot connect to Chrome\'s push notification service (FCM). ';
errorMessage += 'This commonly happens with:\n';
errorMessage += '• Corporate firewalls or VPNs\n';
errorMessage += '• Network security software\n';
errorMessage += '• Restricted internet connections\n\n';
errorMessage += '💡 Workarounds:\n';
errorMessage += '• Try from a different network\n';
errorMessage += '• Disable VPN temporarily\n';
errorMessage += '• Contact your IT department\n';
errorMessage += '• Use a mobile hotspot to test\n\n';
errorMessage += 'The admin panel will still work normally - you just won\'t receive push notifications.';
} else {
errorMessage += `Error: ${error.message}`;
}
this.showNotificationError(errorMessage);
} finally {
button.disabled = false;
button.innerHTML = originalText;