Merge pull request #1039 from MessageKit/3.0.0-swift5

Update to Swift 5
This commit is contained in:
Nathan Tannar
2019-06-29 08:26:33 +08:00
committed by GitHub
35 changed files with 88 additions and 109 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ jobs:
# Specify the Xcode version to use.
macos:
xcode: "10.0.0"
xcode: "10.2.0"
# Define the steps required to build the project.
steps:
+1 -1
View File
@@ -1 +1 @@
4.2
5.0
-1
View File
@@ -12,7 +12,6 @@ custom_rules:
message: "Use like open override or public override instead" # violation message. optional.
severity: warning # violation severity. optional.
opt_in_rules:
- explicit_acl
- explicit_top_level_acl
explicit_acl: error
explicit_top_level_acl: error
+8
View File
@@ -2,6 +2,14 @@
The changelog for `MessageKit`. Also see the [releases](https://github.com/MessageKit/MessageKit/releases) on GitHub.
## Upcoming Release
### Added
- Add loading indicator to AudioMessageCell. [#1084](https://github.com/MessageKit/MessageKit/pull/1084) by [@marcetcheverry](https://github.com/marcetcheverry)
- Lazily initialize the MessageInputBar on MessagesViewController. [#1092](https://github.com/MessageKit/MessageKit/pull/1092) by [@marcetcheverry](https://github.com/marcetcheverry)
## 3.0.0
### Dependency Changes
+1 -1
View File
@@ -1 +1 @@
github "nathantannar4/InputBarAccessoryView" "4.2.1"
github "nathantannar4/InputBarAccessoryView" "4.3.0"
+1 -1
View File
@@ -1,2 +1,2 @@
github "Quick/Quick" ~> 2.0.0
github "Quick/Nimble" ~> 8.0.1
github "Quick/Nimble" ~> 8.0.0
+3 -3
View File
@@ -1,3 +1,3 @@
github "Quick/Nimble" "v7.3.4"
github "Quick/Quick" "v1.3.4"
github "nathantannar4/InputBarAccessoryView" "4.2.2"
github "Quick/Nimble" "v8.0.1"
github "Quick/Quick" "v2.0.0"
github "nathantannar4/InputBarAccessoryView" "4.3.0"
Binary file not shown.
+12 -9
View File
@@ -371,7 +371,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = MessageKit;
TargetAttributes = {
882B5E321CF7D4B900B6E160 = {
@@ -394,6 +394,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
@@ -603,6 +604,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
@@ -651,7 +653,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -660,6 +662,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
@@ -700,7 +703,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
@@ -717,7 +720,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.messagekit.ChatExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -733,7 +736,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.messagekit.ChatExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
@@ -746,7 +749,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.hexedbits.ChatExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ChatExample.app/ChatExample";
};
name = Debug;
@@ -761,7 +764,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.hexedbits.ChatExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ChatExample.app/ChatExample";
};
name = Release;
@@ -774,7 +777,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.hexedbits.ChatExampleUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = ChatExample;
};
name = Debug;
@@ -788,7 +791,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.hexedbits.ChatExampleUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = ChatExample;
};
name = Release;
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
+6 -6
View File
@@ -1,7 +1,7 @@
PODS:
- InputBarAccessoryView (4.2.2)
- MessageKit (3.0.0-beta-swift4-2):
- InputBarAccessoryView
- InputBarAccessoryView (4.3.0)
- MessageKit (3.1.0):
- InputBarAccessoryView (~> 4.3.0)
DEPENDENCIES:
- MessageKit (from `../`)
@@ -15,9 +15,9 @@ EXTERNAL SOURCES:
:path: "../"
SPEC CHECKSUMS:
InputBarAccessoryView: 2b937602598e2fab3149f37f51dd7ad795653812
MessageKit: feb3ca4fa02a14f3391781323ced1da84a0aa73c
InputBarAccessoryView: 28dca73f28df7822fe5377f83cfc4547e22f90ff
MessageKit: 72add24fcba6c6ca1e09385285f6f66757340769
PODFILE CHECKSUM: cecdb7bc8129cf99f66de9f68eea3256fec30c3d
COCOAPODS: 1.6.1
COCOAPODS: 1.7.0
-16
View File
@@ -1,16 +0,0 @@
platform :ios, '9.0'
target 'ChatExample' do
use_frameworks!
pod 'MessageKit', :path => '../'
pod 'MessageInputBar', :git => 'https://github.com/MessageKit/MessageInputBar.git', :branch => 'master'
target 'ChatExampleTests' do
inherit! :search_paths
end
target 'ChatExampleUITests' do
inherit! :search_paths
end
end
+4 -4
View File
@@ -222,7 +222,7 @@ public extension Array {
/**
Shuffle the array in-place using the Fisher-Yates algorithm.
*/
public mutating func shuffle() {
mutating func shuffle() {
for i in 0..<(count - 1) {
let j = Int(arc4random_uniform(UInt32(count - i))) + i
if j != i {
@@ -237,7 +237,7 @@ public extension Array {
- returns: Returns a shuffled version of the array.
*/
public func shuffled() -> [Element] {
func shuffled() -> [Element] {
var list = self
list.shuffle()
@@ -249,7 +249,7 @@ public extension Array {
- returns: Returns a random element from the array or `nil` if the
array is empty.
*/
public func random() -> Element? {
func random() -> Element? {
return (count > 0) ? self.shuffled()[0] : nil
}
@@ -257,7 +257,7 @@ public extension Array {
Return a random subset of `cnt` elements from the array.
- returns: Returns a random subset of `cnt` elements from the array.
*/
public func random(_ count: Int = 1) -> [Element] {
func random(_ count: Int = 1) -> [Element] {
let result = shuffled()
return (count > result.count) ? result : Array(result[0..<count])
+6 -6
View File
@@ -1,27 +1,27 @@
Pod::Spec.new do |s|
s.name = 'MessageKit'
s.version = '3.0.0'
s.version = '3.1.0'
s.license = { :type => "MIT", :file => "LICENSE.md" }
s.summary = 'An elegant messages UI library for iOS.'
s.homepage = 'https://github.com/MessageKit/MessageKit'
s.social_media_url = 'https://twitter.com/nathantannar4'
s.author = { "Nathan Tannar" => "nathantannar4@gmail.com" }
s.social_media_url = 'https://twitter.com/_SD10_'
s.author = { "Steven Deutsch" => "stevensdeutsch@yahoo.com" }
s.source = { :git => 'https://github.com/MessageKit/MessageKit.git', :tag => s.version }
s.source_files = 'Sources/**/*.swift'
s.pod_target_xcconfig = {
"SWIFT_VERSION" => "4.2",
"SWIFT_VERSION" => "5.0",
}
s.swift_version = '4.2'
s.swift_version = '5.0'
s.ios.deployment_target = '9.0'
s.ios.resource_bundle = { 'MessageKitAssets' => 'Assets/MessageKitAssets.bundle/Images' }
s.requires_arc = true
s.dependency 'InputBarAccessoryView'
s.dependency 'InputBarAccessoryView', '~> 4.3.0'
end
+5 -5
View File
@@ -563,7 +563,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 1010;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = MessageKit;
TargetAttributes = {
88916B211CF0DF2F00469F91 = {
@@ -788,7 +788,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -841,7 +841,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
@@ -871,7 +871,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -897,7 +897,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
+1
View File
@@ -155,6 +155,7 @@ Add your app to the list of apps using this library and make a pull request.
- [MediQuo](https://www.mediquo.com)
- [RappresentaMe](https://itunes.apple.com/it/app/rappresentame/id1330914443)
- [WiseEyes](https://itunes.apple.com/us/app/wiseeyes/id1391408511?mt=8)
- [SwiftHub](https://github.com/khoren93/SwiftHub)
*Please provide attribution, it is greatly appreciated.*
@@ -29,13 +29,13 @@ internal extension MessagesViewController {
// MARK: - Register / Unregister Observers
internal func addKeyboardObservers() {
func addKeyboardObservers() {
NotificationCenter.default.addObserver(self, selector: #selector(MessagesViewController.handleKeyboardDidChangeState(_:)), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(MessagesViewController.handleTextViewDidBeginEditing(_:)), name: UITextView.textDidBeginEditingNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(MessagesViewController.adjustScrollViewTopInset), name: UIDevice.orientationDidChangeNotification, object: nil)
}
internal func removeKeyboardObservers() {
func removeKeyboardObservers() {
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
NotificationCenter.default.removeObserver(self, name: UITextView.textDidBeginEditingNotification, object: nil)
NotificationCenter.default.removeObserver(self, name: UIDevice.orientationDidChangeNotification, object: nil)
@@ -95,7 +95,7 @@ internal extension MessagesViewController {
// MARK: - Inset Computation
@objc
internal func adjustScrollViewTopInset() {
func adjustScrollViewTopInset() {
if #available(iOS 11.0, *) {
// No need to add to the top contentInset
} else {
@@ -121,7 +121,7 @@ internal extension MessagesViewController {
}
}
internal func requiredInitialScrollViewBottomInset() -> CGFloat {
func requiredInitialScrollViewBottomInset() -> CGFloat {
guard let inputAccessoryView = inputAccessoryView else { return 0 }
return max(0, inputAccessoryView.frame.height + additionalBottomInset - automaticallyAddedBottomInset)
}
@@ -28,11 +28,11 @@ internal extension MessagesViewController {
// MARK: - Register / Unregister Observers
internal func addMenuControllerObservers() {
func addMenuControllerObservers() {
NotificationCenter.default.addObserver(self, selector: #selector(MessagesViewController.menuControllerWillShow(_:)), name: UIMenuController.willShowMenuNotification, object: nil)
}
internal func removeMenuControllerObservers() {
func removeMenuControllerObservers() {
NotificationCenter.default.removeObserver(self, name: UIMenuController.willShowMenuNotification, object: nil)
}
@@ -34,7 +34,7 @@ UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
open var messagesCollectionView = MessagesCollectionView()
/// The `InputBarAccessoryView` used as the `inputAccessoryView` in the view controller.
open var messageInputBar = InputBarAccessoryView()
open lazy var messageInputBar = InputBarAccessoryView()
/// A Boolean value that determines whether the `MessagesCollectionView` scrolls to the
/// bottom whenever the `InputTextView` begins editing.
+1 -1
View File
@@ -26,7 +26,7 @@ import Foundation
internal extension Bundle {
static func messageKitAssetBundle() -> Bundle { // swiftlint:disable:this explicit_acl
static func messageKitAssetBundle() -> Bundle {
let podBundle = Bundle(for: MessagesViewController.self)
guard let resourceBundleUrl = podBundle.url(forResource: "MessageKitAssets", withExtension: "bundle") else {
+1 -1
View File
@@ -26,7 +26,7 @@ import Foundation
internal extension CGRect {
init(_ x: CGFloat, _ y: CGFloat, _ w: CGFloat, _ h: CGFloat) { // swiftlint:disable:this explicit_acl
init(_ x: CGFloat, _ y: CGFloat, _ w: CGFloat, _ h: CGFloat) {
self.init(x: x, y: y, width: w, height: h)
}
@@ -26,7 +26,7 @@ import Foundation
internal extension NSAttributedString {
func width(considering height: CGFloat) -> CGFloat { // swiftlint:disable:this explicit_acl
func width(considering height: CGFloat) -> CGFloat {
let constraintBox = CGSize(width: .greatestFiniteMagnitude, height: height)
let rect = self.boundingRect(with: constraintBox, options: [.usesLineFragmentOrigin, .usesFontLeading], context: nil)
@@ -24,8 +24,6 @@
import Foundation
// swiftlint:disable explicit_acl
internal extension UIColor {
static let incomingGray = UIColor(red: 230/255, green: 230/255, blue: 235/255, alpha: 1.0)
@@ -24,8 +24,6 @@
import Foundation
// swiftlint:disable explicit_acl
internal extension UIEdgeInsets {
var vertical: CGFloat {
+1 -1
View File
@@ -33,7 +33,7 @@ import UIKit
/// This extension provide a way to access image resources with in framework
public extension UIImage {
public class func messageKitImageWith(type: ImageType) -> UIImage? {
class func messageKitImageWith(type: ImageType) -> UIImage? {
let assetBundle = Bundle.messageKitAssetBundle()
let imagePath = assetBundle.path(forResource: type.rawValue, ofType: "png", inDirectory: "Images")
let image = UIImage(contentsOfFile: imagePath ?? "")
+1 -3
View File
@@ -24,8 +24,6 @@
import UIKit
// swiftlint:disable explicit_acl
internal extension UIView {
func fillSuperview() {
@@ -67,7 +65,7 @@ internal extension UIView {
}
@discardableResult
internal func addConstraints(_ top: NSLayoutYAxisAnchor? = nil, left: NSLayoutXAxisAnchor? = nil, bottom: NSLayoutYAxisAnchor? = nil, right: NSLayoutXAxisAnchor? = nil, centerY: NSLayoutYAxisAnchor? = nil, centerX: NSLayoutXAxisAnchor? = nil, topConstant: CGFloat = 0, leftConstant: CGFloat = 0, bottomConstant: CGFloat = 0, rightConstant: CGFloat = 0, centerYConstant: CGFloat = 0, centerXConstant: CGFloat = 0, widthConstant: CGFloat = 0, heightConstant: CGFloat = 0) -> [NSLayoutConstraint] {
func addConstraints(_ top: NSLayoutYAxisAnchor? = nil, left: NSLayoutXAxisAnchor? = nil, bottom: NSLayoutYAxisAnchor? = nil, right: NSLayoutXAxisAnchor? = nil, centerY: NSLayoutYAxisAnchor? = nil, centerX: NSLayoutXAxisAnchor? = nil, topConstant: CGFloat = 0, leftConstant: CGFloat = 0, bottomConstant: CGFloat = 0, rightConstant: CGFloat = 0, centerYConstant: CGFloat = 0, centerXConstant: CGFloat = 0, widthConstant: CGFloat = 0, heightConstant: CGFloat = 0) -> [NSLayoutConstraint] {
if self.superview == nil {
return []
+1 -1
View File
@@ -94,5 +94,5 @@ public extension AvatarPosition {
static func == (lhs: AvatarPosition, rhs: AvatarPosition) -> Bool {
return lhs.vertical == rhs.vertical && lhs.horizontal == rhs.horizontal
}
}
+2 -2
View File
@@ -58,8 +58,8 @@ public enum DetectorType: Hashable {
}
///The hashValue of the `DetectorType` so we can conform to `Hashable` and be sorted.
public func hash(into: inout Hasher) {
into.combine(toInt())
public func hash(into hasher: inout Hasher) {
hasher.combine(toInt())
}
/// Return an 'Int' value for each `DetectorType` type so `DetectorType` can conform to `Hashable`
+3 -1
View File
@@ -40,6 +40,8 @@ public struct HorizontalEdgeInsets: Equatable {
}
}
// MARK: Equatable Conformance
public extension HorizontalEdgeInsets {
static func == (lhs: HorizontalEdgeInsets, rhs: HorizontalEdgeInsets) -> Bool {
@@ -49,7 +51,7 @@ public extension HorizontalEdgeInsets {
internal extension HorizontalEdgeInsets {
internal var horizontal: CGFloat {
var horizontal: CGFloat {
return left + right
}
}
+3 -3
View File
@@ -25,7 +25,7 @@
import Foundation
/// An object that groups the metadata of a messages sender.
@available(*, deprecated: 3.0.0, message: "`Sender` has been replaced with the `SenderType` protocol in 3.0.0")
@available(*, deprecated, message: "`Sender` has been replaced with the `SenderType` protocol in 3.0.0")
public struct Sender: SenderType {
/// MARK: - Properties
@@ -35,7 +35,7 @@ public struct Sender: SenderType {
/// Note: This value must be unique across all senders.
public let senderId: String
@available(*, deprecated: 3.0.0, message: "`id` has been renamed `senderId` as defined in the `SenderType` protocol")
@available(*, deprecated, message: "`id` has been renamed `senderId` as defined in the `SenderType` protocol")
public var id: String {
return senderId
}
@@ -50,7 +50,7 @@ public struct Sender: SenderType {
self.displayName = displayName
}
@available(*, deprecated: 3.0.0, message: "`id` has been renamed `senderId` as defined in the `SenderType` protocol")
@available(*, deprecated, message: "`id` has been renamed `senderId` as defined in the `SenderType` protocol")
public init(id: String, displayName: String) {
self.init(senderId: id, displayName: displayName)
}
+2 -25
View File
@@ -25,31 +25,8 @@
import UIKit
import InputBarAccessoryView
@available(*, obsoleted: 3.0.0, renamed: "InputBarAccessoryView")
@available(*, deprecated, renamed: "InputBarAccessoryView")
public typealias MessageInputBar = InputBarAccessoryView
@available(*, obsoleted: 3.0.0, renamed: "InputBarAccessoryViewDelegate")
@available(*, deprecated, renamed: "InputBarAccessoryViewDelegate")
public typealias MessageInputBarDelegate = InputBarAccessoryViewDelegate
//public extension MessageInputBarDelegate {
//
// @available(*, obsoleted: 3.0.0, message: "`MessageInputBar` has been replaced with `InputBarAccessoryView` in 3.0.0. Use `inputBar(_ inputBar: InputBarAccessoryView, didPressSendButtonWith text: String)` instead.")
// func messageInputBar(_ inputBar: MessageInputBar, didPressSendButtonWith text: String) {
// }
//
// @available(*, obsoleted: 3.0.0, message: "`MessageInputBar` has been replaced with `InputBarAccessoryView` in 3.0.0. Use `inputBar(_ inputBar: InputBarAccessoryView, textViewTextDidChangeTo text: String)` instead.")
// func messageInputBar(_ inputBar: MessageInputBar, textViewTextDidChangeTo text: String) {
// }
//
// @available(*, obsoleted: 3.0.0, message: "`MessageInputBar` has been replaced with `InputBarAccessoryView` in 3.0.0. Use `inputBar(_ inputBar: InputBarAccessoryView, didChangeIntrinsicContentTo size: CGSize)` instead.")
// func messageInputBar(_ inputBar: MessageInputBar, didChangeIntrinsicContentTo size: CGSize) {
// }
//}
//
//extension InputBarButtonItem {
//
// @available(*, renamed: "inputBarAccessoryView")
// public var messageInputBar: MessageInputBar? {
// return inputBarAccessoryView
// }
//}
+12 -1
View File
@@ -47,18 +47,26 @@ open class AudioMessageCell: MessageContentCell {
return durationLabel
}()
public lazy var activityIndicatorView: UIActivityIndicatorView = {
let activityIndicatorView = UIActivityIndicatorView(style: .gray)
activityIndicatorView.hidesWhenStopped = true
activityIndicatorView.isHidden = true
return activityIndicatorView
}()
public lazy var progressView: UIProgressView = {
let progressView = UIProgressView(progressViewStyle: .default)
progressView.progress = 0.0
return progressView
}()
// MARK: - Methods
/// Responsible for setting up the constraints of the cell's subviews.
open func setupConstraints() {
playButton.constraint(equalTo: CGSize(width: 25, height: 25))
playButton.addConstraints(left: messageContainerView.leftAnchor, centerY: messageContainerView.centerYAnchor, leftConstant: 5)
activityIndicatorView.addConstraints(centerY: playButton.centerYAnchor, centerX: playButton.centerXAnchor)
durationLabel.addConstraints(right: messageContainerView.rightAnchor, centerY: messageContainerView.centerYAnchor, rightConstant: 15)
progressView.addConstraints(left: playButton.rightAnchor, right: durationLabel.leftAnchor, centerY: messageContainerView.centerYAnchor, leftConstant: 5, rightConstant: 5)
}
@@ -66,6 +74,7 @@ open class AudioMessageCell: MessageContentCell {
open override func setupSubviews() {
super.setupSubviews()
messageContainerView.addSubview(playButton)
messageContainerView.addSubview(activityIndicatorView)
messageContainerView.addSubview(durationLabel)
messageContainerView.addSubview(progressView)
setupConstraints()
@@ -75,6 +84,8 @@ open class AudioMessageCell: MessageContentCell {
super.prepareForReuse()
progressView.progress = 0
playButton.isSelected = false
activityIndicatorView.stopAnimating()
playButton.isHidden = false
durationLabel.text = "0:00"
}