Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS does not trigger Push.instance.onNotificationTap on first push notification tapped #16

Closed
ben-aw opened this issue Jun 30, 2023 · 4 comments

Comments

@ben-aw
Copy link

ben-aw commented Jun 30, 2023

Hello,

Push.instance.onNotificationTap.listen does not trigger for iOS the first time a notification is tapped.

I subscribe to Push.instance.onNotificationTap.listen in the apps main function.

If I minimize the app, send a push notification, tap it to open the app, Push.instance.onNotificationTap.listen is never called.

If I minimize the app again and send another push, it will work.

Android works as it should.

Any thoughts as to what might be causing that?
Thanks for your help!

@seanhamstra
Copy link

Seeing this as well.

@seanhamstra
Copy link

This code appears to be the issue. I already have the app running and then opened a push notification. Since userTapsOnNotificationCount is 0 it skips it. But at this point we already checked Push.instance.notificationTapWhichLaunchedAppFromTerminated and the data was null.

        // Avoid sending the message that launched the app. We will send that one when the user requests for the "Push.instance.notificationTapWhichLaunchedAppFromTerminated" (Dart code)
        if (userTapsOnNotificationCount > 0) {
//            let message = PURemoteMessage.fromNotificationContent(content: response.notification.request.content)
            pushFlutterApi.onNotificationTapData(response.notification.request.content.userInfo as! [String: Any]) { _ in  }
        }
        callOriginalDidReceiveDelegateMethod(center: center, response: response, completionHandler: completionHandler)
        userTapsOnNotificationCount += 1
    }

Screen Shot 2023-07-07 at 9 08 13 AM

@ben-xD
Copy link
Owner

ben-xD commented Jul 22, 2023

Looks like @kaiquegazola's MR has fixed it. I've released it as 1.0.1. Thanks for reporting the issue

@ben-aw
Copy link
Author

ben-aw commented Jul 28, 2023

It's working great! Thanks for the fix 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants