| … | … | @@ -3809,49 +3809,19 @@ function setupNativeFeatureListeners() { |
| 3809 | 3809 | } |
| 3810 | 3810 | |
| 3811 | 3811 | // Native Notification Helper |
| 3812 | // NOTE: Native notifications disabled in Pear runtime due to libnotify blocking issues |
| 3813 | // Using in-app toasts only (showSuccess/showError) |
| 3812 | 3814 | function showNotification(title, body, type = 'info') { |
| 3813 | | // Always log to console (primary notification method) |
| 3815 | // Log to console only - native notifications cause UI freeze in Pear runtime |
| 3814 | 3816 | console.log(`📢 Notification: ${title} - ${body}`) |
| 3815 | 3817 | |
| 3816 | | // Run notification in a separate task to avoid blocking UI |
| 3817 | | // Wrap everything in setTimeout(0) to make it non-blocking |
| 3818 | | setTimeout(() => { |
| 3819 | | try { |
| 3820 | | // Check if Notification API is available |
| 3821 | | if ('Notification' in window) { |
| 3822 | | // Request permission if not already granted |
| 3823 | | if (Notification.permission === 'granted') { |
| 3824 | | new Notification(title, { |
| 3825 | | body: body, |
| 3826 | | icon: '/assets/icon.png', // Add app icon if available |
| 3827 | | badge: '/assets/badge.png' |
| 3828 | | }) |
| 3829 | | } else if (Notification.permission !== 'denied') { |
| 3830 | | Notification.requestPermission().then(permission => { |
| 3831 | | if (permission === 'granted') { |
| 3832 | | try { |
| 3833 | | new Notification(title, { |
| 3834 | | body: body, |
| 3835 | | icon: '/assets/icon.png', |
| 3836 | | badge: '/assets/badge.png' |
| 3837 | | }) |
| 3838 | | } catch (err) { |
| 3839 | | // Silently fail - notification not critical |
| 3840 | | console.log('📢 Native notification unavailable (not critical)') |
| 3841 | | } |
| 3842 | | } |
| 3843 | | }).catch(err => { |
| 3844 | | // Silently fail - notification not critical |
| 3845 | | console.log('📢 Notification permission request failed (not critical)') |
| 3846 | | }) |
| 3847 | | } |
| 3848 | | } |
| 3849 | | } catch (err) { |
| 3850 | | // Silently fail if notification system not available |
| 3851 | | // This is expected on systems without notification daemon |
| 3852 | | console.log('📢 Native notifications unavailable (not critical):', err.message) |
| 3853 | | } |
| 3854 | | }, 0) |
| 3818 | // Show in-app notification via toast (non-blocking) |
| 3819 | if (type === 'success') { |
| 3820 | showSuccess(`${title}: ${body}`) |
| 3821 | } else if (type === 'error') { |
| 3822 | showError(`${title}: ${body}`) |
| 3823 | } |
| 3824 | // Native Notification API disabled - causes libnotify blocking in pear-runtime |
| 3855 | 3825 | } |
| 3856 | 3826 | |
| 3857 | 3827 | // Expose functions to global window object for onclick/onchange handlers |