-
Notifications
You must be signed in to change notification settings - Fork 270
What if sending a message failed? #25
Comments
You can do whatever you want with a message if you have a reference to it. There is a func sendMessage(text: String) {
let textContent = TextContentNode(textMessegeString: text)
let message = MessageNode(content: textContent)
var footer = ASTextNode()
footer.attributedText = NSAttributedString() //text indicate sending
message.footerNode = footer
MessageService.sharedInstance.sendText(text, completion: { (error) in
if error {
footer.attributedText = NSAttributedString() //text indicate error
message.footerNode = footer
} else {
footer.attributedText = NSAttributedString() //text indicate delivered
message.footerNode = footer
}
}
} You could also subclass the MessageNode to add tap to retry functionality. |
Fair enough, I think the footer would be the perfect place to show the "delivery status" (sent/user received message/user read message). But for errors, I think it would be much more elegant if it was closer to the native functionality like here in this screenshot: It indents the bubble slightly and then shows an icon. Tapping on it would fire off a retry callback. What do you think? This would be great if it was supported for all of the different bubble types (text based, images, collections etc). How difficult would that be to implement right now? Do you see any issues with this? (I haven't messed around with NMessenger much, but I'm planning to use it soon, so I've no idea how much effort that would be together with ASDK). |
I don't think it would be too difficult to implement it, but I'm not sure when we'll get time to do it. @DavidSchechter might be interested in working on it. For now, though, you could use the |
Thanks for the info. I guess the avatarNode workaround is not a bad idea at all. Would be great if David wants to work on such a functionality and also make it animatable. :) |
Hey,
I was wondering what happens if a message fails to send? For example iMessage and WhatsApp show an exclamation mark next to the message where the user can manually retry to send it.
Is there something similar for NMessager that's already been implemented? I'd use it if the message failed to send for whatever reason (no internet/backend down/internal server error/whatever).
Thanks
The text was updated successfully, but these errors were encountered: