Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions Signal/ConversationView/CellViews/LoadMoreMessagesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ public class LoadMoreMessagesView: UICollectionReusableView {
label.text = OWSLocalizedString("CONVERSATION_VIEW_LOADING_MORE_MESSAGES",
comment: "Indicates that the app is loading more messages in this conversation.")
super.init(frame: frame)
addSubview(label)
label.autoPinEdgesToSuperviewEdges()
label.autoSetDimension(.height, toSize: LoadMoreMessagesView.fixedHeight)
addSubview(blurView)
blurView.contentView.addSubview(label)

blurView.autoPinEdge(toSuperviewEdge: .leading, withInset: 16, relation: .greaterThanOrEqual)
blurView.autoPinEdge(toSuperviewEdge: .trailing, withInset: 16, relation: .greaterThanOrEqual)

label.autoPinEdgesToSuperviewEdges(with: UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16))
label.textAlignment = .center
blurView.autoCenterInSuperview()
Comment on lines -21 to +29
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a blur seems reasonable, but the layout has changed here. I believe the correct thing would be to lay out the blur view the way that label is laid out today:

  • Pin blur view to superview edges
  • Set height of blur view to `LoadMoreMessagesView.fixedHeight

And then make label a subview and pin it to the superview edges with an inset.

To avoid making the label smaller, due to the inset, I'd suggest increasing fixedHeight by 16, to compensate for the 8pt of inset on the top and bottom.

As it is, the height of this is now indeterminate, which could cause subtle layout issues because other components reference fixedHeight.

}

required init?(coder: NSCoder) {
Expand All @@ -32,6 +37,15 @@ public class LoadMoreMessagesView: UICollectionReusableView {

private let label = UILabel()

private let blurView: UIVisualEffectView = {
let blurEffect = UIBlurEffect(style: .systemMaterial)
let view = UIVisualEffectView(effect: blurEffect)
view.layer.cornerRadius = 16
view.clipsToBounds = true

return view
}()

// MARK: Public

public func configureForDisplay() {
Expand Down