OneSignal / OneSignal-Flutter-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal
https://www.onesignal.com
Other
625 stars 214 forks source link

[question]: How to hide notifications if on specific screens? #788

Closed Jiehfeng closed 1 year ago

Jiehfeng commented 1 year ago

How can we help?

If say we are in the chat application screens, the expected behaviour is that notifications shouldn't be displayed as the content is already viewed.

How do I hide OneSignal notifications this way? There was an older method called setInFocusDisplayType I believe but I can't find it now since OneSignal.shared is gone.

Code of Conduct

emawby commented 1 year ago

Hello you are able to use the willDisplayListener and call preventDefault() when you don't want a notification to be displayed. For more migration details you can check out our documentation here.