Skip to content

Commit

Permalink
fixup! Fix visitor-on-hold and unread message count in bubble-view
Browse files Browse the repository at this point in the history
Add comments.
  • Loading branch information
igorkravchenko committed Sep 13, 2023
1 parent 0115146 commit 50190b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions GliaWidgets/Sources/Component/Bubble/BubbleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ class BubbleView: BaseView {

func showOnHoldView() {
onHoldView.removeFromSuperview()

// In case of badge-view being shown
// place on-hold view under it.
if let badgeView {
insertSubview(onHoldView, belowSubview: badgeView)
} else {
Expand Down Expand Up @@ -147,7 +148,9 @@ class BubbleView: BaseView {
private func setView(_ view: UIView) {
subviews.first?.removeFromSuperview()
view.isUserInteractionEnabled = false

// Insert view at the zero index
// to be under other views, like on-hold
// and unread-count views.
insertSubview(view, at: 0)
view.layoutInSuperview().activate()
}
Expand Down
4 changes: 4 additions & 0 deletions GliaWidgets/Sources/Component/Bubble/BubbleWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ private class BubbleViewController: UIViewController {
right: edgeInset
)
)
// Once `bubbleView` is added to view hierarchy,
// we re-render it's `isVisitorOnHold` state,
// to properly display it. Otherwise it may
// not show up due to invalid ('zero') size.
let isOnHold = bubbleView.isVisitorOnHold
bubbleView.isVisitorOnHold = isOnHold
}
Expand Down

0 comments on commit 50190b1

Please sign in to comment.