mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-11 13:56:10 +10:00
Merge branch 'develop' of https://github.com/CatchChat/Yep into develop
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user