-
Notifications
You must be signed in to change notification settings - Fork 270
[readme] Better description of integration with messaging service #95
Comments
So, in order to // Declared in NMessengerViewController
//
override func sendText(_ text: String, isIncomingMessage:Bool) -> GeneralMessengerCell
{
let shouldSendToServer = !isIncomingMessage
if (shouldSendToServer)
{
// trigger network service
self.controller?.sendMessageAsync(text)
}
// otherwise - just render
return super.sendText(text, isIncomingMessage: isIncomingMessage)
} |
Here is a take on error handling #25 |
Receiving a message from the network service : func chatDidReceiveMessages(_ messageList: ChatMessageList)
{
messageList.forEach
{
_ = self.sendText($0.text, isIncomingMessage: true)
}
} |
I'm going to prepare a PR with |
Thank you. I'll merge it in. |
@atainter , I still have some difficulties with the understanding of "async head prefetching". I'd like to cover this topic in my PR as well. Could you explain in a bit more details, please? #97 As a rule, a chat application involves the following actions :
I have not figured out yet how to insert the bubbles for past messages to the top. Is "clearALLMessages()" and invoke "send___()" in a loop the only way for doing that? Is it a correct approach? Does NMessenger take care of the unintended "blinking" animation in such case? My use case might even require So the idea is
Not sure how to implement that with NMessenger although it seems promising as it's built on top of AsyncDisplayKit. |
Actually, it's possible to make a custom insertion using the method below. super.messengerView.addMessages(_,
atIndex:,
scrollToMessage:,
animation:,
completion:) The method is used as a part of batch fetching implementation. |
@dodikk @atainter is it possible to send a typed message withOUT rendering on the ui?.. IE I just want to update the DB when a message is typed
|
Override the function below and do not call open override func onSendButtonTapped(havingText currentText: String) |
Still, It might be a good idea to render the message before receiving an xmpp delivery confirmation to provide the user with some feedback. |
As a new user, I can't figure out which method is responsible for handling user's input.
It's not quite clear where to put the networking code invocation. Is it
sendText
?Oh, I'm subclassing the
NMessengerViewController
.Ideally, I'd like to have the following topics documented :
send message to network
action ?message received from network
event properly?Head Prefetching
?The text was updated successfully, but these errors were encountered: