diff --git a/.circleci/config.yml b/.circleci/config.yml index e4c9ab21..e2a5ffbc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: diff --git a/.swift-version b/.swift-version index bf77d549..819e07a2 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.2 +5.0 diff --git a/.swiftlint.yml b/.swiftlint.yml index 8bf8a3da..5ebf9e77 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7aba7f2d..cbe6a90b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Cartfile b/Cartfile index 50814158..ed7bec6d 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "nathantannar4/InputBarAccessoryView" "4.2.1" +github "nathantannar4/InputBarAccessoryView" "4.3.0" diff --git a/Cartfile.private b/Cartfile.private index 70f82c40..29d169d6 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,2 +1,2 @@ github "Quick/Quick" ~> 2.0.0 -github "Quick/Nimble" ~> 8.0.1 +github "Quick/Nimble" ~> 8.0.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index de18a3b8..7acd3164 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -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" diff --git a/Example/.Podfile.un~ b/Example/.Podfile.un~ deleted file mode 100644 index 8e635e87..00000000 Binary files a/Example/.Podfile.un~ and /dev/null differ diff --git a/Example/ChatExample.xcodeproj/project.pbxproj b/Example/ChatExample.xcodeproj/project.pbxproj index 86d703d4..bfff37ea 100644 --- a/Example/ChatExample.xcodeproj/project.pbxproj +++ b/Example/ChatExample.xcodeproj/project.pbxproj @@ -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; diff --git a/Example/ChatExample.xcodeproj/xcshareddata/xcschemes/ChatExample.xcscheme b/Example/ChatExample.xcodeproj/xcshareddata/xcschemes/ChatExample.xcscheme index e34206a1..31f17b89 100644 --- a/Example/ChatExample.xcodeproj/xcshareddata/xcschemes/ChatExample.xcscheme +++ b/Example/ChatExample.xcodeproj/xcshareddata/xcschemes/ChatExample.xcscheme @@ -1,6 +1,6 @@ 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 diff --git a/Example/Podfile~ b/Example/Podfile~ deleted file mode 100644 index bf44d23b..00000000 --- a/Example/Podfile~ +++ /dev/null @@ -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 diff --git a/Example/Sources/Data Generation/Lorem.swift b/Example/Sources/Data Generation/Lorem.swift index 47597730..b368af71 100755 --- a/Example/Sources/Data Generation/Lorem.swift +++ b/Example/Sources/Data Generation/Lorem.swift @@ -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.. "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 diff --git a/MessageKit.xcodeproj/project.pbxproj b/MessageKit.xcodeproj/project.pbxproj index 4b6ecfac..cfaac857 100644 --- a/MessageKit.xcodeproj/project.pbxproj +++ b/MessageKit.xcodeproj/project.pbxproj @@ -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; }; diff --git a/MessageKit.xcodeproj/xcshareddata/xcschemes/MessageKit.xcscheme b/MessageKit.xcodeproj/xcshareddata/xcschemes/MessageKit.xcscheme index edb000ac..1f6e5d93 100644 --- a/MessageKit.xcodeproj/xcshareddata/xcschemes/MessageKit.xcscheme +++ b/MessageKit.xcodeproj/xcshareddata/xcschemes/MessageKit.xcscheme @@ -1,6 +1,6 @@ CGFloat { + func requiredInitialScrollViewBottomInset() -> CGFloat { guard let inputAccessoryView = inputAccessoryView else { return 0 } return max(0, inputAccessoryView.frame.height + additionalBottomInset - automaticallyAddedBottomInset) } diff --git a/Sources/Controllers/MessagesViewController+Menu.swift b/Sources/Controllers/MessagesViewController+Menu.swift index fefe53ee..9a02f20b 100644 --- a/Sources/Controllers/MessagesViewController+Menu.swift +++ b/Sources/Controllers/MessagesViewController+Menu.swift @@ -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) } diff --git a/Sources/Controllers/MessagesViewController.swift b/Sources/Controllers/MessagesViewController.swift index 0e154c4f..db05420f 100644 --- a/Sources/Controllers/MessagesViewController.swift +++ b/Sources/Controllers/MessagesViewController.swift @@ -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. diff --git a/Sources/Extensions/Bundle+Extensions.swift b/Sources/Extensions/Bundle+Extensions.swift index 2cca400d..ea13d297 100644 --- a/Sources/Extensions/Bundle+Extensions.swift +++ b/Sources/Extensions/Bundle+Extensions.swift @@ -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 { diff --git a/Sources/Extensions/CGRect+Extensions.swift b/Sources/Extensions/CGRect+Extensions.swift index b3cadbd1..f5112a3d 100644 --- a/Sources/Extensions/CGRect+Extensions.swift +++ b/Sources/Extensions/CGRect+Extensions.swift @@ -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) } diff --git a/Sources/Extensions/NSAttributedString+Extensions.swift b/Sources/Extensions/NSAttributedString+Extensions.swift index 4025dac0..e0fe3760 100644 --- a/Sources/Extensions/NSAttributedString+Extensions.swift +++ b/Sources/Extensions/NSAttributedString+Extensions.swift @@ -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) diff --git a/Sources/Extensions/UIColor+Extensions.swift b/Sources/Extensions/UIColor+Extensions.swift index 3c09bbcb..0d85ba9e 100644 --- a/Sources/Extensions/UIColor+Extensions.swift +++ b/Sources/Extensions/UIColor+Extensions.swift @@ -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) diff --git a/Sources/Extensions/UIEdgeInsets+Extensions.swift b/Sources/Extensions/UIEdgeInsets+Extensions.swift index a3fc6153..bd938be8 100644 --- a/Sources/Extensions/UIEdgeInsets+Extensions.swift +++ b/Sources/Extensions/UIEdgeInsets+Extensions.swift @@ -24,8 +24,6 @@ import Foundation -// swiftlint:disable explicit_acl - internal extension UIEdgeInsets { var vertical: CGFloat { diff --git a/Sources/Extensions/UIImage+Extension.swift b/Sources/Extensions/UIImage+Extension.swift index 157fd0f4..5195a1e7 100644 --- a/Sources/Extensions/UIImage+Extension.swift +++ b/Sources/Extensions/UIImage+Extension.swift @@ -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 ?? "") diff --git a/Sources/Extensions/UIView+Extensions.swift b/Sources/Extensions/UIView+Extensions.swift index ec01877f..42bbbbd9 100644 --- a/Sources/Extensions/UIView+Extensions.swift +++ b/Sources/Extensions/UIView+Extensions.swift @@ -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 [] diff --git a/Sources/Models/AvatarPosition.swift b/Sources/Models/AvatarPosition.swift index 60219d1d..c62c99fe 100644 --- a/Sources/Models/AvatarPosition.swift +++ b/Sources/Models/AvatarPosition.swift @@ -94,5 +94,5 @@ public extension AvatarPosition { static func == (lhs: AvatarPosition, rhs: AvatarPosition) -> Bool { return lhs.vertical == rhs.vertical && lhs.horizontal == rhs.horizontal } - + } diff --git a/Sources/Models/DetectorType.swift b/Sources/Models/DetectorType.swift index d2b602a8..1b711a77 100644 --- a/Sources/Models/DetectorType.swift +++ b/Sources/Models/DetectorType.swift @@ -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` diff --git a/Sources/Models/HorizontalEdgeInsets.swift b/Sources/Models/HorizontalEdgeInsets.swift index a1bf6740..91461fa9 100644 --- a/Sources/Models/HorizontalEdgeInsets.swift +++ b/Sources/Models/HorizontalEdgeInsets.swift @@ -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 } } diff --git a/Sources/Models/Sender.swift b/Sources/Models/Sender.swift index 28468785..bd5a31c5 100644 --- a/Sources/Models/Sender.swift +++ b/Sources/Models/Sender.swift @@ -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) } diff --git a/Sources/Supporting/MessageInputBar.swift b/Sources/Supporting/MessageInputBar.swift index 575edd50..a2c2919c 100644 --- a/Sources/Supporting/MessageInputBar.swift +++ b/Sources/Supporting/MessageInputBar.swift @@ -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 -// } -//} diff --git a/Sources/Views/Cells/AudioMessageCell.swift b/Sources/Views/Cells/AudioMessageCell.swift index a9251ce5..b08d7ad5 100644 --- a/Sources/Views/Cells/AudioMessageCell.swift +++ b/Sources/Views/Cells/AudioMessageCell.swift @@ -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" }