[Problem/Question]
When we setup a custom listComponent, open a message channel screen, close it and open the screen again the scroll stop working. If we don’t setup a listComponent this just works fine.
[UIKit Version]
SendbirdChatSDK 4.2.0
SendbirdUIKit 3.3.1
[Reproduction Steps]
Setup a custom listComponent:
SBUModuleSet.groupChannelModule.listComponent = CustomGroupChannelModuleList()
Open a message channel screen, close it and open the screen again and try to scroll through the messages.
Our code:
SendbirdChat.initialize(
params: initParams,
migrationStartHandler: {
print("Sendbird migration started - \(Date())")
onMigrationStarted?()
},
completionHandler: { error in
if let error = error {
print("Sendbird migration error: \(error.localizedDescription)")
onMigrationError?(error)
} else {
print("Sendbird migration completed - \(Date())")
onMigrationCompleted?()
}
}
)
SBUModuleSet.groupChannelModule.listComponent = CustomGroupChannelModuleList()
SBUModuleSet.groupChannelModule.listComponent?.register(adminMessageCell: CustomAdminCell())
SBUModuleSet.groupChannelModule.listComponent?.register(userMessageCell: CustomUserMessageCell())
SBUModuleSet.groupChannelModule.listComponent?.register(fileMessageCell: CustomFileMessageCell())
SBUModuleSet.groupChannelModule.listComponent?.channelStateBanner = CustomChannelStateBanner()
SBUGlobals.isChannelListMessageReceiptStateEnabled = true
SBUGlobals.isChannelListTypingIndicatorEnabled = false
SBUGlobals.isUserProfileEnabled = false
SBUGlobals.isUserMentionEnabled = false
The problem is with:
SBUModuleSet.groupChannelModule.listComponent = CustomGroupChannelModuleList()
The CustomGroupChannelModuleList:
class CustomGroupChannelModuleList: SBUGroupChannelModule.List {
override func configureCell(_ messageCell: SBUBaseMessageCell, message: BaseMessage, forRowAt indexPath: IndexPath) {
super.configureCell(messageCell, message: message, forRowAt: indexPath)
let bookmarkedIds = BookmarkManager.shared.bookmarkedIds
let bookmarked = bookmarkedIds.first(where: { $0.bookmarkableId == String(message.messageId) }) != nil
if let cell = messageCell as? CustomUserMessageCell {
cell.configure(bookmarked: bookmarked)
cell.bookmarkButton.action(.touchUpInside) { [weak self] _ in
self?.bookmarkMessage(message) { result in
cell.configure(bookmarked: result)
}
}
} else if let cell = messageCell as? CustomFileMessageCell {
cell.configure(bookmarked: bookmarked)
cell.bookmarkButton.action(.touchUpInside) { [weak self] _ in
self?.bookmarkMessage(message) { result in
cell.configure(bookmarked: result)
}
}
}
}
private func bookmarkMessage(_ message: BaseMessage, completion: @escaping (Bool) -> Void) {
// ...
}
}
[Frequency]
Every time we open the message channel screen by the second time.
[Current impact]
We can’t add and use our customizations.