expo-community / expo-server-sdk-python

Exponent Server SDK
MIT License
146 stars 42 forks source link

How to override PushMessage? #35

Closed DBain07 closed 3 years ago

DBain07 commented 3 years ago

I am attempting to get interactive push notifications working on IOS. I'm using setNotificationCategoryAsync with my react-native app to create the category, and using the 'category' field in PushMessage seems to do the job just fine for android (specified notification appears as expected). However, the interactive notifications don't work on IOS. To try and fix this, I was hoping to try adding the 'categoryIdentifier' field to PushMessage, and I was wondering how I would go about overriding this to include the extra field?

julianpacker commented 3 years ago

You could add that field to the PushMessage class and get_payload function and we can get that pushed up ASAP.

Alternatively you can override the class by creating a Child class which inherits from the parent and adds that field to the payload.

I prefer option 1 as then everyone gets access to the new field

DBain07 commented 3 years ago

Unfortunately, using categoryIdentifier does not enable interactive notifications on ios. I had to use the method described in https://github.com/expo/expo/issues/10467 for the time being (sending category: @yourUsername/yourProjectSlug-chat)