diff --git a/Yep/ViewControllers/Conversation/ConversationViewController.swift b/Yep/ViewControllers/Conversation/ConversationViewController.swift index fcbf96ba..6e4a5240 100644 --- a/Yep/ViewControllers/Conversation/ConversationViewController.swift +++ b/Yep/ViewControllers/Conversation/ConversationViewController.swift @@ -718,7 +718,7 @@ class ConversationViewController: BaseViewController { sendText(text, toRecipient: withFriend.userID, recipientType: "User", afterCreatedMessage: { [weak self] message in dispatch_async(dispatch_get_main_queue()) { - self?.updateConversationCollectionViewWithMessageIDs(nil, messageAge: .New, scrollToBottom: true, success: { success in + self?.updateConversationCollectionViewWithMessageIDs(nil, messageAge: .New, scrollToBottom: true, success: { _ in }) } @@ -1906,34 +1906,26 @@ class ConversationViewController: BaseViewController { let keyboardAndToolBarHeight = adjustHeight - let blockedHeight = topBarsHeight + keyboardAndToolBarHeight + let blockedHeight = topBarsHeight + (feedView != nil ? FeedView.foldHeight : 0) + keyboardAndToolBarHeight let visibleHeight = conversationCollectionView.frame.height - blockedHeight // cal the height can be used let useableHeight = visibleHeight - conversationCollectionView.contentSize.height - let totalHeight = conversationCollectionView.contentSize.height + blockedHeight + newMessagesTotalHeight - - if totalHeight > conversationCollectionView.frame.height { + if newMessagesTotalHeight > useableHeight { UIView.animateWithDuration(0.2, delay: 0.0, options: UIViewAnimationOptions.CurveEaseInOut, animations: { [weak self] in if let strongSelf = self { - if (useableHeight > 0) { - let contentToScroll = newMessagesTotalHeight - useableHeight - strongSelf.conversationCollectionView.contentOffset.y += contentToScroll + if scrollToBottom { + let newContentSize = strongSelf.conversationCollectionView.collectionViewLayout.collectionViewContentSize() + let newContentOffsetY = newContentSize.height - strongSelf.conversationCollectionView.frame.height + keyboardAndToolBarHeight + strongSelf.conversationCollectionView.contentOffset.y = newContentOffsetY } else { - if scrollToBottom { - let newContentSize = strongSelf.conversationCollectionView.collectionViewLayout.collectionViewContentSize() - let newContentOffsetY = newContentSize.height - strongSelf.conversationCollectionView.frame.height + keyboardAndToolBarHeight - strongSelf.conversationCollectionView.contentOffset.y = newContentOffsetY - - } else { - strongSelf.conversationCollectionView.contentOffset.y += newMessagesTotalHeight - } + strongSelf.conversationCollectionView.contentOffset.y += newMessagesTotalHeight } } diff --git a/Yep/Views/Feed/FeedView.swift b/Yep/Views/Feed/FeedView.swift index 0619c175..7adb6796 100644 --- a/Yep/Views/Feed/FeedView.swift +++ b/Yep/Views/Feed/FeedView.swift @@ -164,7 +164,7 @@ class FeedView: UIView { var normalHeight: CGFloat { guard let feed = feed else { - return 60 + return FeedView.foldHeight } let rect = feed.body.boundingRectWithSize(CGSize(width: FeedView.messageTextViewMaxWidth, height: CGFloat(FLT_MAX)), options: [.UsesLineFragmentOrigin, .UsesFontLeading], attributes: YepConfig.FeedView.textAttributes, context: nil)