[Problem/Question]
I recently just updated Sendbird Chat and SendbirdUIKit to 4.6.2 and 3.5.2 respectively and now I am having problems where it is frequently loading in the wrong Channel. I am currently manually creating the view controller by using the statement SBUGroupChannelViewController(channelURL: channelUrl)
. This was rarely a problem in the last version I had (3.2.2 for UIKit and 4.1.4 for SendbirdChat). Sometimes is does load in the right view controller, but then if exit that view and I try with a different channelUrl it will show the old channel. Then the next time I try to load a channel, it will load in the channel that was supposed to load the 2nd time. This then cascades and continues to mostly load in the wrong channel.
[Reproduction Steps]
`struct ChannelView: UIViewControllerRepresentable {
let channelUrl: String
func makeUIViewController(
context _: Context
) -> SBUGroupChannelViewController {
let channelVC = SBUGroupChannelViewController(channelURL: channelUrl)
return channelVC
}
func updateUIViewController(
_ uiViewController: SBUGroupChannelViewController,
context: Context
) {
guard let inputComponent = uiViewController.inputComponent,
let inputView = inputComponent.messageInputView,
let messageInputView = inputView as? SBUMessageInputView,
let listComponent = uiViewController.listComponent
else {
return
}
context.coordinator.inputView = messageInputView
context.coordinator.listComponent = listComponent
messageInputView.sendButton?.addTarget(
context.coordinator,
action: #selector(Coordinator.didTapSend(_:)),
for: .touchDown
)
messageInputView.addButton?.addTarget(
context.coordinator,
action: #selector(Coordinator.didTapAdd(_:)),
for: .touchDown
)
messageInputView.saveButton?.addTarget(
context.coordinator,
action: #selector(Coordinator.didTapSave(_:)),
for: .touchDown
)
messageInputView.cancelButton?.addTarget(
context.coordinator,
action: #selector(Coordinator.didTapCancel(_:)),
for: .touchDown
)
let scrollBottomButton = listComponent.scrollBottomView?.subviews.first { $0 is UIButton } as? UIButton
scrollBottomButton?.addTarget(
context.coordinator,
action: #selector(Coordinator.didTapScrollToBottom(_:)),
for: .touchDown
)
}
func makeCoordinator() -> Coordinator {
Coordinator()
}
class Coordinator {
var inputView: SBUMessageInputView!
var listComponent: SBUGroupChannelModule.List!
@objc func didTapSend(_ sender: Any) {
inputView.onClickSendButton(sender)
}
@objc func didTapAdd(_ sender: Any) {
inputView.onClickAddButton(sender)
}
@objc func didTapSave(_ sender: Any) {
inputView.onClickSaveButton(sender)
}
@objc func didTapCancel(_ sender: Any) {
inputView.onClickCancelButton(sender)
}
@objc func didTapScrollToBottom(_: Any) {
listComponent.onTapScrollToBottom()
}
}
}`
[Frequency]
This is happening extremely frequent and is honestly unusable now.
[Current impact]
Yes this is preventing me from using the app since it pretty much always loads in the wrong channel.