From ea824fb6ca1913e3e725699bd4a74e70fd9fed13 Mon Sep 17 00:00:00 2001 From: Chad Curtis Date: Sun, 1 Mar 2026 07:15:03 +0000 Subject: [PATCH] Fix notification toggle disabled on Android: treat native platform as always supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The settings page checked for the browser Notification API to determine support, but Android WebView doesn't expose that API. The Java foreground service handles notifications natively, so the check was wrong — it showed 'not supported' and disabled the toggle on every APK install. --- src/pages/NotificationSettings.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pages/NotificationSettings.tsx b/src/pages/NotificationSettings.tsx index 54f52e05..b9e80c6e 100644 --- a/src/pages/NotificationSettings.tsx +++ b/src/pages/NotificationSettings.tsx @@ -1,4 +1,5 @@ import { useState, useEffect } from 'react'; +import { Capacitor } from '@capacitor/core'; import { useSeoMeta } from '@unhead/react'; import { ArrowLeft, Bell, BellOff, AlertTriangle } from 'lucide-react'; import { Link, Navigate } from 'react-router-dom'; @@ -31,7 +32,7 @@ export function NotificationSettings() { const pushEnabled = settings?.notificationsEnabled ?? false; const handleTogglePush = async (enabled: boolean) => { - if (enabled) { + if (enabled && !Capacitor.isNativePlatform()) { if (!('Notification' in window)) return; // Request browser permission first (no-op if already granted/denied) @@ -50,8 +51,11 @@ export function NotificationSettings() { return ; } - const isSupported = 'Notification' in window; - const isDenied = permission === 'denied'; + // Native platforms use the Java foreground service for notifications, + // not the browser Notification API — always supported. + const isNative = Capacitor.isNativePlatform(); + const isSupported = isNative || 'Notification' in window; + const isDenied = !isNative && permission === 'denied'; return (