Skip to content

Commit

Permalink
Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislavDevIOS committed Jul 20, 2022
1 parent 6c44c3b commit 63f1dc1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Adamant/Stories/Chats/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ class ChatViewController: MessagesViewController {

var feeUpdateTimer: Timer?

private let headerHeight: CGFloat = 38

// MARK: Rich Messages
var richMessageProviders = [String:RichMessageProvider]()
var cellCalculators = [String:CellSizeCalculator]()
Expand Down Expand Up @@ -587,7 +589,7 @@ class ChatViewController: MessagesViewController {
if let offset = self.chatsProvider.chatPositon[address] {
self.chatPositionOffset = CGFloat(offset)
self.scrollToBottomBtn.isHidden = chatPositionOffset < chatPositionDelata
let collectionViewContentHeight = messagesCollectionView.collectionViewLayout.collectionViewContentSize.height - CGFloat(offset) - (messagesCollectionView.scrollIndicatorInsets.bottom + messagesCollectionView.contentInset.bottom) + 38
let collectionViewContentHeight = messagesCollectionView.collectionViewLayout.collectionViewContentSize.height - CGFloat(offset) - (messagesCollectionView.scrollIndicatorInsets.bottom + messagesCollectionView.contentInset.bottom) + headerHeight

messagesCollectionView.performBatchUpdates(nil) { _ in self.messagesCollectionView.scrollRectToVisible(CGRect(x: 0.0, y: collectionViewContentHeight - 1.0, width: 1.0, height: 1.0), animated: false)
}
Expand Down Expand Up @@ -1127,7 +1129,7 @@ extension ChatViewController {
}

func loadFirstMessagesIfNeeded() {
guard let address = chatroom?.partner?.address else { return }
guard let address = chatroom?.partner?.address else { return }

if let isLoaded = chatsProvider.isChatLoaded[address],
isLoaded {
Expand Down

0 comments on commit 63f1dc1

Please sign in to comment.