From 53845330f907cfd1425a3cd89679b8b061275e8c Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Thu, 20 Nov 2025 04:37:08 +0000 Subject: [PATCH] feat(test-app): add notification delivery indicator - Add visual indicator when notification is received (shows for 30s) - Poll notification status every 5 seconds to detect recent deliveries - Add helpful message in test notification success about checking top of screen - Improve user feedback for notification testing workflow --- .../app/src/main/assets/public/index.html | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/test-apps/android-test-app/app/src/main/assets/public/index.html b/test-apps/android-test-app/app/src/main/assets/public/index.html index 99d4950..5f60ee0 100644 --- a/test-apps/android-test-app/app/src/main/assets/public/index.html +++ b/test-apps/android-test-app/app/src/main/assets/public/index.html @@ -62,6 +62,11 @@
Loading plugin status...
+ @@ -232,7 +237,8 @@ const notificationTimeReadable = notificationTime.toLocaleTimeString(); status.innerHTML = '✅ Notification scheduled!
' + '📥 Prefetch: ' + prefetchTimeReadable + ' (' + prefetchTimeString + ')
' + - '🔔 Notification: ' + notificationTimeReadable + ' (' + notificationTimeString + ')'; + '🔔 Notification: ' + notificationTimeReadable + ' (' + notificationTimeString + ')

' + + '💡 When the notification fires, look for a banner at the top of your screen.'; status.style.background = 'rgba(0, 255, 0, 0.3)'; // Green background // Refresh plugin status display setTimeout(() => loadPluginStatus(), 500); @@ -411,6 +417,39 @@ } } + // Check for notification delivery periodically + function checkNotificationDelivery() { + if (!window.DailyNotification) return; + + window.DailyNotification.getNotificationStatus() + .then(result => { + if (result.lastNotificationTime) { + const lastTime = new Date(result.lastNotificationTime); + const now = new Date(); + const timeDiff = now - lastTime; + + // If notification was received in the last 2 minutes, show indicator + if (timeDiff > 0 && timeDiff < 120000) { + const indicator = document.getElementById('notificationReceivedIndicator'); + const timeSpan = document.getElementById('notificationReceivedTime'); + + if (indicator && timeSpan) { + indicator.style.display = 'block'; + timeSpan.textContent = `Received at ${lastTime.toLocaleTimeString()}`; + + // Hide after 30 seconds + setTimeout(() => { + indicator.style.display = 'none'; + }, 30000); + } + } + } + }) + .catch(error => { + // Silently fail - this is just for visual feedback + }); + } + // Load plugin status automatically on page load window.addEventListener('load', () => { console.log('Page loaded, loading plugin status...'); @@ -419,6 +458,9 @@ loadPluginStatus(); loadPermissionStatus(); loadChannelStatus(); + + // Check for notification delivery every 5 seconds + setInterval(checkNotificationDelivery, 5000); }, 500); });