I believe I’ve implemented SyncManager and the delegates correctly - but the collection(_ collection: SBSMMessageCollection, didReceive action: SBSMMessageEventAction, pendingMessages: [SBDBaseMessage])
delegate is never called. I only ever receive the success delegate.
My collection is setup as follows:
let filter: SBSMMessageFilter = SBSMMessageFilter(messageType: .all, customType: nil, senderUserIds: nil)
let viewpointTimestamp: Int64 = Int64.max
self.messageCollection = SBSMMessageCollection.init(channel: channel, filter: filter, viewpointTimestamp: viewpointTimestamp, limit: 1000, reverse: false)
self.messageCollection?.delegate = self
self.fetchMessages()
I send a user message like this:
channel.sendUserMessage(text) { sendBirdMessage, error in
if let error = error {
print(error.localizedDescription)
return
}
guard let sendBirdMessage = sendBirdMessage else {
return
}
messageCollection.appendMessage(sendBirdMessage)
}
Interestingly - the ‘sendingStatus’ of the message returned within the closure is ‘successful’ - not ‘pending’ as I would expect based on the tutorial. Perhaps this is why it isn’t triggering the delegate… but then, at what point do I have a ‘pending’ messsage to add to the collection? In this scenario, on slow connections - when a user sends a message - there is a long pause while it is ‘sent’ - ideally I’d want the pending message represented in UI here but thats tricky to do as I only receive a SBDBaseMessage
after attempting to send, and I can’t use a placeholder model as I don’t have an ID for the message yet… perhaps I’m misunderstanding a core concept here