Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIS-1096] Fix an issue for ChatThreadVC opened from a deeplink #1354

Merged
merged 2 commits into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- Fixed race condition on `ChatMessageListVC` and `ChatThreadVC` that caused `UITableView` crashes [#1347](https://github.com/GetStream/stream-chat-swift/pull/1347)
- Added `GalleryAttachmentViewInjector.galleryViewAspectRatio` to control the aspect ratio of a gallery inside a message cell [#1300](https://github.com/GetStream/stream-chat-swift/pull/1300)
- Fixed an issue for `ChatThreadVC` opened from a deeplink when new replies are only added to the chat, but not to the replies thread [#1354](https://github.com/GetStream/stream-chat-swift/pull/1354)

# [4.0.0-beta.9](https://github.com/GetStream/stream-chat-swift/releases/tag/4.0.0-beta.9)
_August 05, 2021_
Expand Down
22 changes: 15 additions & 7 deletions Sources/StreamChatUI/ChatMessageList/ChatThreadVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,26 @@ open class ChatThreadVC:
messageComposerVC.channelController = channelController
messageComposerVC.userSearchController = userSuggestionSearchController

messageController.delegate = self
messageController.synchronize()
messageController.loadPreviousReplies()

if let message = messageController.message {
messageComposerVC.content.threadMessage = message
let updateMessageControllerMessage: () -> Void = { [messageController, messageComposerVC] in
if messageComposerVC.content.threadMessage == nil,
let message = messageController?.message {
messageComposerVC.content.threadMessage = message
}
}

messageController.delegate = self
updateMessageControllerMessage()

userSuggestionSearchController.search(term: nil)

channelController.setDelegate(self)
channelController.synchronize()

channelController.synchronize { [messageController] _ in
messageController?.synchronize { _ in
updateMessageControllerMessage()
messageController?.loadPreviousReplies()
}
}

if let cid = channelController.cid {
headerView.channelController = channelController.client.channelController(for: cid)
Expand Down