Open GutteApps opened 6 years ago
For showing a badge, –conversation:unreadCountDidChange:
would be a better callback than -conversation:didReceiveMessages:
, since it would also update you when messages have been read and the count is reset to zero.
We don't currently expose SKTConversationDelegate
in the react-native wrapper though, so you would need to do the handling in your Obj-C or Swift code.
I'm not sure what you're asking for the push notification thing. Yes, Smooch will swizzle those methods by default, but we always call through to your application's own implementation after performing our work, so there shouldn't be any conflicts. You can also disable swizzling by setting enableAppDelegateSwizzling and enableUserNotificationCenterDelegateOverride to false
, and following the instructions in the documentation to make sure Smooch continues to receive and handle push notifications
Thanks. So, for a cross-platform solution, the easier route would be handling the push notification (as opposed to handling the delegate messages on each platform separately) ?
I don't think handling push notifications will cover all cases. It will allow you to increment the badge on new messages, but you won't be able to set it back to zero when the unread count is reset
well, I could reset the counter when the user opens the chat window. I agree, this isn't optimal but would work as a temporary solution. Do you have any plans on exposing the delegate messages to RN or add the ability listen to these events?
Yes, that solution could work.
This library is not under active development in terms of new features or expanded API support, so it's unlikely we'll be exposing that soon. But we do review and often merge submitted pull requests with new features, so if you wanted to submit a PR you're more than welcome to do so.
Trying to show the user a badge inside the app when new messages arrive. In the native iOS sdk, there is a delegate method that handles this ( func conversation(_ conversation: SKTConversation, didReceiveMessages messages: [Any])) I would use the incoming push notification as trigger but (at least in ios) the appdelegate messages for handling notifications are swizzled by default by the Smooch SDK. Any ideas on how to get around that?