wip: expand/collapse emojis

pull/638/head
Ryan Zhao 3 years ago
parent 6af2d29582
commit 38665e6c33

@ -10,6 +10,7 @@ final class ReactionContainerView : UIView {
private var showingAllReactions = false private var showingAllReactions = false
var reactions: [(String, (Int, Bool))] = []
var reactionViews: [ReactionView] = [] var reactionViews: [ReactionView] = []
var expandButton: ExpandingReactionButton? var expandButton: ExpandingReactionButton?
@ -33,6 +34,7 @@ final class ReactionContainerView : UIView {
} }
public func update(_ reactions: [(String, (Int, Bool))]) { public func update(_ reactions: [(String, (Int, Bool))]) {
self.reactions = reactions
prepareForUpdate() prepareForUpdate()
let stackView = UIStackView() let stackView = UIStackView()
@ -58,7 +60,7 @@ final class ReactionContainerView : UIView {
} }
if expandButtonReactions.count > 0 { if expandButtonReactions.count > 0 {
expandButton = ExpandingReactionButton(emojis: expandButtonReactions) expandButton = ExpandingReactionButton(emojis: expandButtonReactions)
stackView.addArrangedSubview(expandButton) stackView.addArrangedSubview(expandButton!)
} else { } else {
expandButton = nil expandButton = nil
} }
@ -72,6 +74,12 @@ final class ReactionContainerView : UIView {
} }
reactionViews = [] reactionViews = []
} }
public func showAllEmojis() {
guard !showingAllReactions else { return }
showingAllReactions = true
update(reactions)
}
} }

@ -562,6 +562,7 @@ final class VisibleMessageCell : MessageCell, LinkPreviewViewDelegate {
} }
if let expandButton = reactionContainerView.expandButton, expandButton.frame.contains(convertedLocation) { if let expandButton = reactionContainerView.expandButton, expandButton.frame.contains(convertedLocation) {
// TODO: show all emojis // TODO: show all emojis
reactionContainerView.
} }
} else { } else {
delegate?.handleViewItemTapped(viewItem, gestureRecognizer: gestureRecognizer) delegate?.handleViewItemTapped(viewItem, gestureRecognizer: gestureRecognizer)

Loading…
Cancel
Save