wip: expand/collapse emojis

This commit is contained in:
Ryan Zhao 2022-05-19 17:20:50 +10:00
parent 6af2d29582
commit 38665e6c33
2 changed files with 10 additions and 1 deletions

View File

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

View File

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