Skip to content

Commit 1b7b63c

Browse files
authored
Merge pull request #1792 from MessageKit/fixAdvancedController
Fix typing indicator in advanced example controller
2 parents 13ce40c + 22d3963 commit 1b7b63c

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ The changelog for `MessageKit`. Also see the [releases](https://github.com/Messa
77
### Added
88

99
### Fixed
10+
11+
- Fix Advanced example hiding indicator [#1792](https://github.com/MessageKit/MessageKit/pull/1792) by [@kaspik](https://github.com/Kaspik)
1012

1113
### Changed
1214

Example/Sources/View Controllers/AdvancedExampleViewController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ final class AdvancedExampleViewController: ChatViewController {
7474

7575
MockSocket.shared.connect(with: [SampleData.shared.nathan, SampleData.shared.wu])
7676
.onTypingStatus { [weak self] in
77-
self?.setTypingIndicatorViewHidden(false)
77+
self?.setTypingIndicatorViewHidden(false, animated: true)
7878
}.onNewMessage { [weak self] message in
79-
self?.setTypingIndicatorViewHidden(true, performUpdates: {
79+
self?.setTypingIndicatorViewHidden(true, animated: false, performUpdates: {
8080
self?.insertMessage(message)
8181
})
8282
}
@@ -190,9 +190,9 @@ final class AdvancedExampleViewController: ChatViewController {
190190
return messageList[indexPath.section].user == messageList[indexPath.section + 1].user
191191
}
192192

193-
func setTypingIndicatorViewHidden(_ isHidden: Bool, performUpdates updates: (() -> Void)? = nil) {
193+
func setTypingIndicatorViewHidden(_ isHidden: Bool, animated: Bool, performUpdates updates: (() -> Void)? = nil) {
194194
updateTitleView(title: "MessageKit", subtitle: isHidden ? "2 Online" : "Typing...")
195-
setTypingIndicatorViewHidden(isHidden, animated: true, whilePerforming: updates) { [weak self] success in
195+
setTypingIndicatorViewHidden(isHidden, animated: animated, whilePerforming: updates) { [weak self] success in
196196
if success, self?.isLastSectionVisible() == true {
197197
self?.messagesCollectionView.scrollToLastItem(animated: true)
198198
}

0 commit comments

Comments
 (0)