Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fill area under message entry with same bg color as message entry #1162

Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion GliaWidgets/Sources/Theme/Theme+Chat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ extension Theme {
placeholderFont: font.bodyText,
placeholderColor: color.baseShade,
separatorColor: color.baseShade,
backgroundColor: color.baseLight,
backgroundColor: color.baseNeutral,
mediaButton: mediaButton,
sendButton: sendButton,
uploadList: uploadListStyle,
Expand Down
8 changes: 8 additions & 0 deletions GliaWidgets/Sources/View/Chat/ChatView.DefineLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,13 @@ extension ChatView {

bringSubviewToFront(entryWidgetOverlayView)
bringSubviewToFront(entryWidgetContainerView)

constraints += [
messageEntryBottomArea.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor),
messageEntryBottomArea.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor),
messageEntryBottomArea.topAnchor.constraint(equalTo: messageEntryView.bottomAnchor),
messageEntryBottomArea.bottomAnchor.constraint(lessThanOrEqualTo: bottomAnchor)
]
insertSubview(messageEntryBottomArea, at: 0)
}
}
9 changes: 9 additions & 0 deletions GliaWidgets/Sources/View/Chat/ChatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@
let secureMessagingBottomBannerView = SecureMessagingBottomBannerView().makeView()
let sendingMessageUnavailabilityBannerView = SendingMessageUnavailableBannerView().makeView()

// Instead of modifying message entry view's layout to resize, covering bottom safe area,
// thus affecting existing layout calculations, we add additional view just for that,
// keeping background color for it reactively in sync with message entry view's one.
lazy var messageEntryBottomArea = UIView().makeView { [weak messageEntryView] area in
messageEntryView?.publisher(for: \.backgroundColor).sink { [weak area] newColor in
area?.backgroundColor = newColor
}.store(in: &cancelBag)
}

let style: ChatStyle
let environment: Environment

Expand Down Expand Up @@ -991,4 +1000,4 @@
view.setOperatorImage(fromUrl: imageUrl, animated: false)
return .gvaPersistentButton(view)
}
}

Check warning on line 1003 in GliaWidgets/Sources/View/Chat/ChatView.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

File Length Violation: File should contain 1000 lines or less: currently contains 1003 (file_length)
Loading