feat: trigger notification provider refresh upon receiving FCM push notifications

This commit is contained in:
pradeepkumar
2026-03-28 18:53:12 +05:30
parent d9399a7be3
commit 76ab8612a4
2 changed files with 9 additions and 0 deletions

View File

@@ -164,6 +164,9 @@ class PushNotificationService {
}
}
/// Callback to refresh notification count when FCM arrives
void Function()? onNotificationReceived;
void _onForegroundMessage(RemoteMessage message) {
debugPrint('[FCM] Foreground message: ${message.notification?.title}');
@@ -178,6 +181,9 @@ class PushNotificationService {
return;
}
// Refresh notification count immediately
onNotificationReceived?.call();
// Show local notification on Android (iOS handles it natively)
if (Platform.isAndroid) {
_localNotifications?.show(