mirror of
https://github.com/MessageKit/MessageKit.git
synced 2026-02-06 19:03:19 +00:00
Merge branch 'master' into CameraInputBar
This commit is contained in:
@@ -6,6 +6,43 @@ The changelog for `MessageKit`. Also see the [releases](https://github.com/Messa
|
||||
|
||||
### Fixed
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
### Removed
|
||||
|
||||
## 3.6.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixes an issue with Scroll problem on new messages with keyboard open [#1529](https://github.com/MessageKit/MessageKit/pull/1529) by [@politan8](https://github.com/politan8)
|
||||
|
||||
- Fixes time stamp vertical alignment so labels align with messages when showMessageTimestampOnSwipeLeft is true.
|
||||
by [@kurtsequoia](https://github.com/MessageKit/MessageKit/pull/1556)
|
||||
|
||||
- **Breaking Change** Changed `MessagesLayoutDelegate`'s method for typing indicator size. Typing indicator's size is now correctly calculated based on delegate method `func typingIndicatorViewSize(for layout: MessagesCollectionViewFlowLayout) -> CGSize` [#1563](https://github.com/MessageKit/MessageKit/pull/1563) by [@kaspik](https://github.com/kaspik)
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
- Changed `resource_bundle` back to `resources` in MessageKit.podspec [#1565](https://github.com/MessageKit/MessageKit/pull/1565) by [@kaspik](https://github.com/kaspik)
|
||||
|
||||
### Removed
|
||||
|
||||
## 3.5.1
|
||||
|
||||
### Fixed
|
||||
- `MessagesViewController` now smoothly scrolls messages off screen. [1531](https://github.com/MessageKit/MessageKit/issues/1531) & [1547](https://github.com/MessageKit/MessageKit/pull/1547) by [@mredig](https://github.com/mredig)
|
||||
|
||||
### Changed
|
||||
- Bump `InputBarAccessoryView`
|
||||
|
||||
## 3.5.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- maintainPositionOnKeyboardFrameChanged for small contentSize would scroll content out of bounds [#1506](https://github.com/MessageKit/MessageKit/pull/1506) by [@martinpucik](https://github.com/martinpucik)
|
||||
|
||||
### Added
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
github "Quick/Nimble" "v8.1.2"
|
||||
github "Quick/Quick" "v2.2.1"
|
||||
github "nathantannar4/InputBarAccessoryView" "5.2.1"
|
||||
@@ -100,13 +100,13 @@ public struct Sender: SenderType {
|
||||
}
|
||||
|
||||
// Some global variables for the sake of the example. Using globals is not recommended!
|
||||
let sender = Sender(id: "any_unique_id", displayName: "Steven")
|
||||
let sender = Sender(senderId: "any_unique_id", displayName: "Steven")
|
||||
let messages: [MessageType] = []
|
||||
|
||||
extension ChatViewController: MessagesDataSource {
|
||||
|
||||
func currentSender() -> SenderType {
|
||||
return Sender(id: "any_unique_id", displayName: "Steven")
|
||||
return Sender(senderId: "any_unique_id", displayName: "Steven")
|
||||
}
|
||||
|
||||
func numberOfSections(in messagesCollectionView: MessagesCollectionView) -> Int {
|
||||
|
||||
@@ -23,4 +23,4 @@
|
||||
|
||||
source 'https://rubygems.org'
|
||||
gem 'danger', '~> 6.2'
|
||||
gem 'danger-swiftlint', '~> 0.24'
|
||||
gem 'danger-swiftlint', '~> 0.24'
|
||||
|
||||
+7
-7
@@ -24,29 +24,29 @@ GEM
|
||||
no_proxy_fix
|
||||
octokit (~> 4.7)
|
||||
terminal-table (~> 1)
|
||||
danger-swiftlint (0.24.3)
|
||||
danger-swiftlint (0.24.5)
|
||||
danger
|
||||
rake (> 10)
|
||||
thor (~> 0.19)
|
||||
faraday (0.17.3)
|
||||
faraday (0.17.4)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
faraday-http-cache (2.2.0)
|
||||
faraday (>= 0.8)
|
||||
git (1.7.0)
|
||||
git (1.8.1)
|
||||
rchardet (~> 1.8)
|
||||
kramdown (2.3.0)
|
||||
kramdown (2.3.1)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
multipart-post (2.1.1)
|
||||
nap (1.1.0)
|
||||
no_proxy_fix (0.1.2)
|
||||
octokit (4.18.0)
|
||||
octokit (4.20.0)
|
||||
faraday (>= 0.9)
|
||||
sawyer (~> 0.8.0, >= 0.5.3)
|
||||
open4 (1.3.4)
|
||||
public_suffix (4.0.5)
|
||||
rake (13.0.1)
|
||||
public_suffix (4.0.6)
|
||||
rake (13.0.3)
|
||||
rchardet (1.8.0)
|
||||
rexml (3.2.4)
|
||||
sawyer (0.8.2)
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'MessageKit'
|
||||
s.version = '3.4.2'
|
||||
s.version = '3.6.0'
|
||||
s.license = { :type => "MIT", :file => "LICENSE.md" }
|
||||
|
||||
s.summary = 'An elegant messages UI library for iOS.'
|
||||
@@ -14,8 +14,8 @@ Pod::Spec.new do |s|
|
||||
s.swift_version = '5.3'
|
||||
|
||||
s.ios.deployment_target = '12.0'
|
||||
s.ios.resource_bundle = { 'MessageKit' => 'Sources/Assets.xcassets' }
|
||||
s.ios.resources = 'Sources/Assets.xcassets'
|
||||
|
||||
s.dependency 'InputBarAccessoryView', '~> 5.2.1'
|
||||
s.dependency 'InputBarAccessoryView', '~> 5.3.1'
|
||||
|
||||
end
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ let package = Package(
|
||||
.library(name: "MessageKit", targets: ["MessageKit"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/nathantannar4/InputBarAccessoryView", .upToNextMajor(from: "5.2.1"))
|
||||
.package(url: "https://github.com/nathantannar4/InputBarAccessoryView", .upToNextMajor(from: "5.3.1"))
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
[](https://github.com/MessageKit/MessageKit/actions?query=workflow%3A%22Danger%22)
|
||||
|
||||
[](https://codecov.io/gh/MessageKit/MessageKit)
|
||||
[](https://github.com/Carthage/Carthage)
|
||||
<a href="https://swift.org">
|
||||
<img src="https://img.shields.io/badge/Swift-5-green.svg" alt="Swift" />
|
||||
</a>
|
||||
@@ -66,14 +65,6 @@ pod 'MessageKit', '~> 3.3.0'
|
||||
pod 'MessageKit', '~> 3.0.0'
|
||||
```
|
||||
|
||||
### [Carthage](https://github.com/Carthage/Carthage)
|
||||
|
||||
To integrate MessageKit using Carthage, add the following to your `Cartfile`:
|
||||
|
||||
```
|
||||
github "MessageKit/MessageKit"
|
||||
```
|
||||
|
||||
### [Swift Package Manager](https://swift.org/package-manager/)
|
||||
|
||||
Swift 5.3 in Xcode 12 [added support](https://github.com/apple/swift-evolution/blob/master/proposals/0271-package-manager-resources.md) for assets in Swift Packages.
|
||||
@@ -197,6 +188,9 @@ Add your app to the list of apps using this library and make a pull request.
|
||||
- [SmooveText](https://apps.apple.com/np/app/smoove-text/id1362792811)
|
||||
- [COYO Engage](https://apps.apple.com/app/coyo-engage/id1341588804)
|
||||
- [HitchPin](https://www.hitchpin.com)
|
||||
- [Charge Running](https://apps.apple.com/app/charge-running-live-coaching/id1204578360)
|
||||
- [HER](https://apps.apple.com/us/app/id573328837)
|
||||
- [Girlfriend Plus](https://apps.apple.com/us/app/girlfriend-plus/id1011637655)
|
||||
|
||||
_Please provide attribution, it is greatly appreciated._
|
||||
|
||||
@@ -206,6 +200,8 @@ _Please provide attribution, it is greatly appreciated._
|
||||
- [@nathantannar4](https://github.com/nathantannar4), Nathan Tannar
|
||||
- [@zhongwuzw](https://github.com/zhongwuzw), Wu Zhong
|
||||
- [@austinwright](https://github.com/austinwright), Austin Wright
|
||||
- [@kaspik](https://github.com/kaspik), Jakub Kaspar
|
||||
- [@martinpucik](https://github.com/martinpucik), Martin Pucik
|
||||
|
||||
## Thanks
|
||||
|
||||
|
||||
@@ -98,6 +98,10 @@ internal extension MessagesViewController {
|
||||
let newBottomInset = requiredScrollViewBottomInset(forKeyboardFrame: keyboardEndFrame)
|
||||
let differenceOfBottomInset = newBottomInset - messageCollectionViewBottomInset
|
||||
|
||||
UIView.performWithoutAnimation {
|
||||
messageCollectionViewBottomInset = newBottomInset
|
||||
}
|
||||
|
||||
if maintainPositionOnKeyboardFrameChanged && differenceOfBottomInset != 0 {
|
||||
let contentOffset = CGPoint(x: messagesCollectionView.contentOffset.x, y: messagesCollectionView.contentOffset.y + differenceOfBottomInset)
|
||||
// Changing contentOffset to bigger number than the contentSize will result in a jump of content
|
||||
@@ -107,10 +111,6 @@ internal extension MessagesViewController {
|
||||
}
|
||||
messagesCollectionView.setContentOffset(contentOffset, animated: false)
|
||||
}
|
||||
|
||||
UIView.performWithoutAnimation {
|
||||
messageCollectionViewBottomInset = newBottomInset
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Inset Computation
|
||||
|
||||
@@ -223,10 +223,12 @@ UICollectionViewDelegateFlowLayout, UICollectionViewDataSource, UIGestureRecogni
|
||||
private func setupDefaults() {
|
||||
extendedLayoutIncludesOpaqueBars = true
|
||||
view.backgroundColor = .collectionViewBackground
|
||||
messagesCollectionView.contentInsetAdjustmentBehavior = .never
|
||||
messagesCollectionView.keyboardDismissMode = .interactive
|
||||
messagesCollectionView.alwaysBounceVertical = true
|
||||
messagesCollectionView.backgroundColor = .collectionViewBackground
|
||||
if #available(iOS 13.0, *) {
|
||||
messagesCollectionView.automaticallyAdjustsScrollIndicatorInsets = false
|
||||
}
|
||||
}
|
||||
|
||||
private func setupDelegates() {
|
||||
@@ -241,7 +243,7 @@ UICollectionViewDelegateFlowLayout, UICollectionViewDataSource, UIGestureRecogni
|
||||
private func setupConstraints() {
|
||||
messagesCollectionView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
let top = messagesCollectionView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor)
|
||||
let top = messagesCollectionView.topAnchor.constraint(equalTo: view.topAnchor)
|
||||
let bottom = messagesCollectionView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
|
||||
let leading = messagesCollectionView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor)
|
||||
let trailing = messagesCollectionView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor)
|
||||
|
||||
@@ -29,12 +29,7 @@ internal extension Bundle {
|
||||
static var messageKitAssetBundle: Bundle = Bundle.module
|
||||
#else
|
||||
static var messageKitAssetBundle: Bundle {
|
||||
guard let url = Bundle(for: MessagesViewController.self).url(forResource: "MessageKit", withExtension: "bundle"),
|
||||
let resourcesBundle = Bundle(url: url)
|
||||
else {
|
||||
fatalError(MessageKitError.couldNotLoadAssetsBundle)
|
||||
}
|
||||
return resourcesBundle
|
||||
return Bundle(for: MessagesViewController.self)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -26,18 +26,13 @@ import UIKit
|
||||
|
||||
open class TypingCellSizeCalculator: CellSizeCalculator {
|
||||
|
||||
open var height: CGFloat = 62
|
||||
|
||||
public init(layout: MessagesCollectionViewFlowLayout? = nil) {
|
||||
super.init()
|
||||
self.layout = layout
|
||||
}
|
||||
|
||||
open override func sizeForItem(at indexPath: IndexPath) -> CGSize {
|
||||
guard let layout = layout else { return .zero }
|
||||
let collectionViewWidth = layout.collectionView?.bounds.width ?? 0
|
||||
let contentInset = layout.collectionView?.contentInset ?? .zero
|
||||
let inset = layout.sectionInset.horizontal + contentInset.horizontal
|
||||
return CGSize(width: collectionViewWidth - inset, height: height)
|
||||
guard let layout = layout as? MessagesCollectionViewFlowLayout else { return .zero }
|
||||
return layout.messagesLayoutDelegate.typingIndicatorViewSize(for: layout)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,12 +52,11 @@ public protocol MessagesLayoutDelegate: AnyObject {
|
||||
/// Specifies the size to use for a typing indicator view.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - messagesCollectionView: The `MessagesCollectionView` in which this view will be displayed.
|
||||
/// - layout: The `MessagesCollectionViewFlowLayout` layout.
|
||||
///
|
||||
/// - Note:
|
||||
/// The default value returned by this method is the width of the `messagesCollectionView` and
|
||||
/// a height of 52.
|
||||
func typingIndicatorViewSize(in messagesCollectionView: MessagesCollectionView) -> CGSize
|
||||
/// The default value returned by this method is the width of the `messagesCollectionView` minus insets and a height of 62.
|
||||
func typingIndicatorViewSize(for layout: MessagesCollectionViewFlowLayout) -> CGSize
|
||||
|
||||
/// Specifies the top inset to use for a typing indicator view.
|
||||
///
|
||||
@@ -134,8 +133,11 @@ public extension MessagesLayoutDelegate {
|
||||
return .zero
|
||||
}
|
||||
|
||||
func typingIndicatorViewSize(in messagesCollectionView: MessagesCollectionView) -> CGSize {
|
||||
return CGSize(width: messagesCollectionView.bounds.width, height: 48)
|
||||
func typingIndicatorViewSize(for layout: MessagesCollectionViewFlowLayout) -> CGSize {
|
||||
let collectionViewWidth = layout.messagesCollectionView.bounds.width
|
||||
let contentInset = layout.messagesCollectionView.contentInset
|
||||
let inset = layout.sectionInset.horizontal + contentInset.horizontal
|
||||
return CGSize(width: collectionViewWidth - inset, height: 62)
|
||||
}
|
||||
|
||||
func typingIndicatorViewTopInset(in messagesCollectionView: MessagesCollectionView) -> CGFloat {
|
||||
|
||||
@@ -357,7 +357,8 @@ open class MessageContentCell: MessageCollectionViewCell {
|
||||
/// - attributes: The `MessagesCollectionViewLayoutAttributes` for the cell.
|
||||
open func layoutTimeLabelView(with attributes: MessagesCollectionViewLayoutAttributes) {
|
||||
let paddingLeft: CGFloat = 10
|
||||
let origin = CGPoint(x: UIScreen.main.bounds.width + paddingLeft, y: contentView.frame.size.height * 0.5)
|
||||
let origin = CGPoint(x: UIScreen.main.bounds.width + paddingLeft,
|
||||
y: messageContainerView.frame.minY + messageContainerView.frame.height * 0.5 - messageTimestampLabel.font.ascender * 0.5)
|
||||
let size = CGSize(width: attributes.messageTimeLabelSize.width, height: attributes.messageTimeLabelSize.height)
|
||||
messageTimestampLabel.frame = CGRect(origin: origin, size: size)
|
||||
}
|
||||
|
||||
@@ -232,7 +232,6 @@ final class MessagesViewControllerTests: XCTestCase {
|
||||
|
||||
func testDefaultPropertyValues() {
|
||||
let controller = MessagesViewController()
|
||||
XCTAssertFalse(controller.scrollsToBottomOnKeyboardBeginsEditing)
|
||||
XCTAssertTrue(controller.canBecomeFirstResponder)
|
||||
XCTAssertFalse(controller.shouldAutorotate)
|
||||
XCTAssertNotNil(controller.inputAccessoryView)
|
||||
|
||||
Reference in New Issue
Block a user