From 8ef9fc8a8e7136b827ad0f20d9cdae070a03453e Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Mon, 13 Nov 2017 11:15:04 +0800 Subject: [PATCH 1/3] Fix MessageInputBar translucent property --- Sources/Views/MessageInputBar.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/Views/MessageInputBar.swift b/Sources/Views/MessageInputBar.swift index 07cd87d7..48fa9c2c 100644 --- a/Sources/Views/MessageInputBar.swift +++ b/Sources/Views/MessageInputBar.swift @@ -74,7 +74,10 @@ open class MessageInputBar: UIView { } blurView.isHidden = !isTranslucent let color: UIColor = backgroundView.backgroundColor ?? .white - backgroundView.backgroundColor = isTranslucent ? color.withAlphaComponent(0.75) : .white + backgroundView.backgroundColor = isTranslucent ? color.withAlphaComponent(0.75) : color.withAlphaComponent(1.0) + + let bgColor: UIColor = backgroundColor ?? .inputBarGray + backgroundColor = isTranslucent ? bgColor.withAlphaComponent(0.75) : bgColor.withAlphaComponent(1.0) } } From 9f6c494c1747214db876bb8c1065152a48c3e5d9 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Tue, 14 Nov 2017 12:20:33 +0800 Subject: [PATCH 2/3] remove MessageInputBar backgroundColor --- Sources/Views/MessageInputBar.swift | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/Sources/Views/MessageInputBar.swift b/Sources/Views/MessageInputBar.swift index 48fa9c2c..06ff3707 100644 --- a/Sources/Views/MessageInputBar.swift +++ b/Sources/Views/MessageInputBar.swift @@ -41,17 +41,10 @@ open class MessageInputBar: UIView { open var backgroundView: UIView = { let view = UIView() view.translatesAutoresizingMaskIntoConstraints = false - view.backgroundColor = .white + view.backgroundColor = .inputBarGray return view }() - /// Also sets the backgroundView's backgroundColor to the newValue - open override var backgroundColor: UIColor? { - didSet { - backgroundView.backgroundColor = backgroundColor - } - } - /** A UIVisualEffectView that adds a blur effect to make the view appear transparent. @@ -73,11 +66,8 @@ open class MessageInputBar: UIView { blurView.fillSuperview() } blurView.isHidden = !isTranslucent - let color: UIColor = backgroundView.backgroundColor ?? .white + let color: UIColor = backgroundView.backgroundColor ?? .inputBarGray backgroundView.backgroundColor = isTranslucent ? color.withAlphaComponent(0.75) : color.withAlphaComponent(1.0) - - let bgColor: UIColor = backgroundColor ?? .inputBarGray - backgroundColor = isTranslucent ? bgColor.withAlphaComponent(0.75) : bgColor.withAlphaComponent(1.0) } } @@ -294,7 +284,6 @@ open class MessageInputBar: UIView { /// Sets up the default properties open func setup() { - backgroundColor = .inputBarGray autoresizingMask = [.flexibleHeight] setupSubviews() setupConstraints() From eb6bafb5a7ff1d8f218836238537434458b8b483 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Tue, 14 Nov 2017 14:27:23 +0800 Subject: [PATCH 3/3] Add CHANGELOG entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10a3fbde..f01bbbb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ and the initializer has changed from `public init(image: UIImage? = nil, initals 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). +- Fixed `MessageInputBar`'s `translucent` functionality. +[#348](https://github.com/MessageKit/MessageKit/pull/348) by [@zhongwuzw](https://github.com/zhongwuzw). + ### Removed - **Breaking Change** Removed `AvatarAlignment` and `avatarAlignment(for:at:in)` delegate method