Skip to content

Commit

Permalink
Fill area under message entry with same bg color as message entry
Browse files Browse the repository at this point in the history
With recent changes for SC 2.0 design, area under message entry must be of the same color as message entry background color.

MOB-3889
  • Loading branch information
igorkravchenko committed Dec 20, 2024
1 parent 59069f2 commit db2b9a3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
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 @@ class ChatView: EngagementView {
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

0 comments on commit db2b9a3

Please sign in to comment.