Hi, I am working with integrating iOS chat SDK. Having issue with reactions loading, after joining channel I am loading message collection with cache, and here is what I am getting in cache and api completion blocks. The reactions amount are different, and what is interesting that cached result is correct and api result is not!
Cached messages nil
Text: 11 - reactions count: 0
Text: 12 - reactions count: 0
Text: 13 - reactions count: 0
Text: 14 - reactions count: 0
Text: 15 - reactions count: 0
Text: 16 - reactions count: 0
Text: 17 - reactions count: 0
Text: 18 - reactions count: 0
Text: 19 - reactions count: 0
Text: 20 - reactions count: 0
Text: 21 - reactions count: 0
Text: 22 - reactions count: 0
Text: 23 - reactions count: 1
Text: 25 - reactions count: 1
Text: Hi, - reactions count: 3
Text: 11hie - reactions count: 0
Text: hi - reactions count: 0
Text: https://sendbird.com - reactions count: 0
Text: testeerdf - reactions count: 2
Text: 1d1 - reactions count: 1
Api messages nil
Text: 11 - reactions count: 0
Text: 12 - reactions count: 0
Text: 13 - reactions count: 0
Text: 14 - reactions count: 0
Text: 15 - reactions count: 0
Text: 16 - reactions count: 0
Text: 17 - reactions count: 0
Text: 18 - reactions count: 0
Text: 19 - reactions count: 0
Text: 20 - reactions count: 0
Text: 21 - reactions count: 0
Text: 22 - reactions count: 0
Text: 23 - reactions count: 0
Text: 25 - reactions count: 0
Text: Hi, - reactions count: 0
Text: 11hie - reactions count: 0
Text: hi - reactions count: 0
Text: https://sendbird.com - reactions count: 0
Text: testeerdf - reactions count: 0
Text: 1d1 - reactions count: 0
Here is peace of code
private var listParams: MessageListParams {
let params = MessageListParams()
params.reverse = false
params.previousResultSize = 20
params.nextResultSize = 20
return params
}
private var startingPoint: Int64 {
return Int64((Date().timeIntervalSince1970 * 1000.0).rounded())
}
collection = SendbirdChat.createMessageCollection(channel: groupChannel, startingPoint: startingPoint, params: listParams)
collection?.delegate = self
collection?.startCollection(initPolicy: .cacheAndReplaceByApi, cacheResultHandler: { messages, error in
print("Cached messages", error)
messages?.forEach({ message in
print("Text: \(message.message) - reactions count: \(message.reactions.count)")
})
completion(.success(messages?.map({ ChatMessage(message: $0) }) ?? []))
}, apiResultHandler: { messages, error in
print("Api messages", error)
messages?.forEach({ message in
print("Text: \(message.message) - reactions count: \(message.reactions.count)")
})
completion(.success(messages?.map({ ChatMessage(message: $0) }) ?? []))
})