onesignal-expo-plugin
onesignal-expo-plugin copied to clipboard
[question]: Does the plugin adds Communications Notification in iOS?
How can we help?
Is it possible to enable and set or send Communications Notifications with specific user avatars like here in iOS in Expo Managed Workflow?
OneSignal Expo SDK version
1.1.2
Platform
iOS
Relevant log output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Hi @bayramn! The OneSignal expo plugin provides a pre-canned NSE. There are 2 ways to go with the current functionality:
- eject to bare workflow, modify the NSE as needed.
- Fork this repo and point your app to the forked repo, override the pre-canned NSE with your implementation, and continue building under the managed workflow.
Thinking longer term, what do you think of the plugin providing an "NSE Path" config option which allows you to provide your own NSE file?
Hi @brismithers, thanks for the response. Since I am new to mobile dev and react native, I have no idea how to modify native code through Expo Plugins. I found out about the plugins through Expo Forum and was wondering of onesignal-expo-plugin already has in it.
For long term I think Communications Notifications should be already included in this Expo Plugin if it is possible, because Notifications User Avatars are mostly used by all apps and maybe newbie Expo devs coming from Managed Flow would find extremely hard to write their own Expo Plugins and NSE file.
@bayramn unfortunately we haven't found a way to "get back to react native" from the native Notification Service Extension, which is the mechanism communication notifications must be implemented through (amongst other things). So I believe you must write/maintain your own native NSE.
What we can implement is provide a configuration option for onesignal-expo-plugin
which allows you to specify the location your own NSE, rather than use the plugin's pre-canned extension. Configuration would be something like this:
"plugins": [
[
"onesignal-expo-plugin",
{
"mode": "development",
"nse": "./assets/NotificationService.m"
}
]]
Please let me know your thoughts!
@brismithers got it. What would best way to learn to write my own pre-canned NSE? I literally have no idea how to go about it.
Hi @brismithers -
Just commenting to say that I think it would be neat to have the option to specify the location of a custom NSE.
We were hoping to add an activity feed in our app by listening for background notifications (as per 'option 2' here: https://documentation.onesignal.com/docs/create-an-activity-feed#option-2-save-the-notification-when-received). It seems like the ability to create a custom NSE would allow us to do that ourselves, without filing a feature request here
appreciate the feedback! We will work to have this available shortly. @bayramn once the NSE configuration option is available, the plugin will take care of the iOS configuration, as it already does so using a canned NSE found here.
You will need to focus on writing the appropriate objective-c/swift code logic in the didReceiveNotificationRequest method. Some additional resources:
https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension https://documentation.onesignal.com/docs/service-extensions#ios-notification-service-extension
@brismithers got it. Thanks for links.