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

Handling local notification event for IOS 10+ #104

Merged

Conversation

MorganTrudeau
Copy link
Contributor

Summary

Closes #102

Local notification event is being managed by depreciated method. To make this work I have added support for new method used to handle local notification clicks.
I have implemented this feature in the same way the other local notification event was built.
This does not have any breaking changes as I implemented a new method that is used for IOS 10+

Test Plan

  • Local notification event should work on IOS 10+ with new didReceiveNotificationResponse and prior to IOS 10 using old didReceiveLocalNotification method.
  • We need to ensure localNotification event is being fired when tapping local notification on a device with IOS 10.
  • To support old versions of IOS this should also be tested on a device with older SDK to ensure the event is still being fired.

What's required for testing (prerequisites)?

  • Augment AppDelegate.m with new didReceiveNotificationResponse method mention in README.
  • Set up app to present local notifications

What are the steps to reproduce (after prerequisites)?

  • Present a local notification and tap it
  • Local notification event should fire with notification data

Compatibility

OS Implemented
iOS
Android

Checklist

  • [x ] I have tested this on a device and a simulator
  • [x ] I added the documentation in README.md
  • [x ] I added a sample use of the API in the example project (example/App.js)

@galkn
Copy link

galkn commented Apr 16, 2020

Thanks for adding this. Just curious, is didReceiveLocalNotification still supported in iOS>10, and if so, does it mean both handlers get called on tap? or does iOS>10 pick didReceiveNotificationResponse when both are provided?

@MorganTrudeau
Copy link
Contributor Author

@galkn didReceiveLocalNotification doesn't get called at all in iOS > 10. didReceiveNotificationResponse is the only method that is called when local notification is tapped.

@benjaminaudet
Copy link

benjaminaudet commented Apr 28, 2020

Any ideas about when it'll be merged ? @Naturalclar

And thanks for your work @MorganTrudeau

Thanks :D

Copy link
Collaborator

@Naturalclar Naturalclar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MorganTrudeau Thanks so much for the PR!

@Naturalclar Naturalclar merged commit c30425e into react-native-push-notification:master May 1, 2020
@jSkrills
Copy link

Hey @MorganTrudeau, for some reason I am seeing this method not be called when my app is in the background. Is this by design? Is there something else that's supposed to get that event?

I am currently having to use this workaround in my didFinishLaunchingWithOptions to get didReceiveNotificationResponse to fire when my app is in the background.

I would like to avoid this bc i'd rather not the first thing a user sees when downloading the app be a permission request. I'd like to do welcome screen things, get them signed up etc.

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

Successfully merging this pull request may close these issues.

PushNotificationIOS.addEventListener Doesn't Work
6 participants