pusher / push-notifications-flutter

Official Pusher Beams Flutter client plugin (iOS, Android and Web), receive notifications easily on your Flutter application with Pusher Beams.
https://pub.dev/packages/pusher_beams
MIT License
11 stars 30 forks source link

[IOS] The onMessageReceivedInTheForeground callback triggers multiple times for a single notification #53

Open ebabhi opened 1 month ago

ebabhi commented 1 month ago

Issue

When the app is in the foreground and receives a notification, the onMessageReceivedInTheForeground callback is triggered multiple times.

Expected Behaviour

onMessageReceivedInTheForeground should only be triggered once per notification.

Steps to replicate

  1. Set up Pusher Beams on iOS.
  2. Add a callback to onMessageReceivedInTheForeground.
  3. The callback will be triggered multiple times.

Logs from Xcode for a single notification


SwiftPusherBeamsPlugin: message received: ["body": "DEBUG", "data": Optional({
    pusher =     {
        instanceId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
        publishId = "pubid-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
        userShouldIgnore = 1;
    };
}), "title": "DEBUG"]
flutter: {pusher: {userShouldIgnore: true, publishId: pubid-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, instanceId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}}
SwiftPusherBeamsPlugin: message received: ["body": "DEBUG", "data": nil, "title": "DEBUG"]
SwiftPusherBeamsPlugin: message received: ["body": "DEBUG", "data": Optional({
    pusher =     {
        instanceId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
        publishId = "pubid-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
        userShouldIgnore = 1;
    };
}), "title": "DEBUG"]
flutter: null
flutter: {pusher: {userShouldIgnore: true, publishId: pubid-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, instanceId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}}
SwiftPusherBeamsPlugin: message received: ["body": "DEBUG", "data": nil, "title": "DEBUG"]
SwiftPusherBeamsPlugin: message received: ["body": "DEBUG", "data": nil, "title": "DEBUG"]
flutter: null
flutter: null
SwiftPusherBeamsPlugin: message received: ["body": "DEBUG", "data": nil, "title": "DEBUG"]
flutter: null