From 3efbdbd260025a4973ab156f5bbec32d5b738a68 Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Sat, 4 Nov 2017 02:33:22 -0500 Subject: [PATCH 1/3] Fix bottom label origin bugs --- Example/Podfile.lock | 4 ++-- Sources/Layout/MessagesCollectionViewFlowLayout.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 9a6cd95e..150ea00f 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - MessageKit (0.10.0) + - MessageKit (0.10.1) DEPENDENCIES: - MessageKit (from `../MessageKit.podspec`) @@ -9,7 +9,7 @@ EXTERNAL SOURCES: :path: ../MessageKit.podspec SPEC CHECKSUMS: - MessageKit: dc900db857e89ac994f1afeb1080539de7fabde4 + MessageKit: b0cd905fa1872952f25ff5ea8e67d7135fe7e176 PODFILE CHECKSUM: 9ac65b8dedf0e1b63fea245b089b6645c4e66309 diff --git a/Sources/Layout/MessagesCollectionViewFlowLayout.swift b/Sources/Layout/MessagesCollectionViewFlowLayout.swift index 7010597a..717ed15d 100644 --- a/Sources/Layout/MessagesCollectionViewFlowLayout.swift +++ b/Sources/Layout/MessagesCollectionViewFlowLayout.swift @@ -780,7 +780,7 @@ fileprivate extension MessagesCollectionViewFlowLayout { guard attributes.cellBottomLabelSize != .zero else { return .zero } - var origin = CGPoint(x: 0, y: contentFrame.height - attributes.cellBottomLabelSize.height) + var origin = CGPoint(x: 0, y: attributes.cellTopLabelSize.height + attributes.messageContainerSize.height + attributes.messageVerticalPadding) switch (attributes.cellBottomLabelAlignment, attributes.avatarHorizontal) { case (.cellLeading, _): @@ -792,7 +792,7 @@ fileprivate extension MessagesCollectionViewFlowLayout { case (.messageLeading, .cellLeading): origin.x = attributes.avatarSize.width + attributes.messageContainerPadding.left case (.messageLeading, .cellTrailing): - origin.x = contentFrame.width - attributes.avatarSize.width - attributes.messageContainerPadding.right - attributes.cellBottomLabelSize.width + origin.x = contentFrame.width - attributes.avatarSize.width - attributes.messageContainerPadding.right - attributes.messageContainerSize.width case (.messageTrailing, .cellTrailing): origin.x = contentFrame.width - attributes.avatarSize.width - attributes.messageContainerPadding.right - attributes.cellBottomLabelSize.width case (.messageTrailing, .cellLeading): From 276eaf5c00489fe4464875fa97861e636f6a4ab3 Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Sat, 4 Nov 2017 03:43:42 -0500 Subject: [PATCH 2/3] Add CHANGELOG entry for #326 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f78f1d47..9386599b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ The changelog for `MessageKit`. Also see the [releases](https://github.com/Messa ## Upcoming release +### Fixed + +- Fixed `cellbottomLabel` origin X for the `.messageLeading` alignment and +origin Y so that the `cellBottomLabel` is always under the `MessageContainerView`. +[#326](https://github.com/MessageKit/MessageKit/pull/326) by [@SD10](https://github.com/sd10). + ## [[Prerelease] 0.10.1](https://github.com/MessageKit/MessageKit/releases/tag/0.10.1) ### Fixed From 413ff9972cbcd0cb0b308ec1d2d7b31657e67809 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Tue, 7 Nov 2017 14:59:16 +0800 Subject: [PATCH 3/3] Fix keyboard not dismiss on iOS9 --- Example/Sources/ConversationViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Example/Sources/ConversationViewController.swift b/Example/Sources/ConversationViewController.swift index 39c3fe5c..573c421f 100644 --- a/Example/Sources/ConversationViewController.swift +++ b/Example/Sources/ConversationViewController.swift @@ -64,6 +64,7 @@ class ConversationViewController: MessagesViewController { @objc func handleKeyboardButton() { + messageInputBar.inputTextView.resignFirstResponder() let actionSheetController = UIAlertController(title: "Change Keyboard Style", message: nil, preferredStyle: .actionSheet) let actions = [ UIAlertAction(title: "Slack", style: .default, handler: { _ in @@ -172,7 +173,6 @@ class ConversationViewController: MessagesViewController { } func defaultStyle() { - messageInputBar.inputTextView.resignFirstResponder() let newMessageInputBar = MessageInputBar() newMessageInputBar.sendButton.tintColor = UIColor(red: 69/255, green: 193/255, blue: 89/255, alpha: 1) newMessageInputBar.delegate = self