|
|
@ -18,6 +18,7 @@ final class ReactionContainerView : UIView {
|
|
|
|
|
|
|
|
|
|
|
|
private var showingAllReactions = false
|
|
|
|
private var showingAllReactions = false
|
|
|
|
private var isOutgoingMessage = false
|
|
|
|
private var isOutgoingMessage = false
|
|
|
|
|
|
|
|
private var maxEmojisPerLine = isIPhone6OrSmaller ? 5 : 6
|
|
|
|
|
|
|
|
|
|
|
|
var reactions: [(String, (Int, Bool))] = []
|
|
|
|
var reactions: [(String, (Int, Bool))] = []
|
|
|
|
var reactionViews: [ReactionView] = []
|
|
|
|
var reactionViews: [ReactionView] = []
|
|
|
@ -83,9 +84,9 @@ final class ReactionContainerView : UIView {
|
|
|
|
var displayedReactions: [(String, (Int, Bool))]
|
|
|
|
var displayedReactions: [(String, (Int, Bool))]
|
|
|
|
var expandButtonReactions: [String]
|
|
|
|
var expandButtonReactions: [String]
|
|
|
|
|
|
|
|
|
|
|
|
if reactions.count >= 6 {
|
|
|
|
if reactions.count > maxEmojisPerLine {
|
|
|
|
displayedReactions = Array(reactions[0...2])
|
|
|
|
displayedReactions = Array(reactions[0...(maxEmojisPerLine - 3)])
|
|
|
|
expandButtonReactions = Array(reactions[3...5]).map{ $0.0 }
|
|
|
|
expandButtonReactions = Array(reactions[(maxEmojisPerLine - 2)...maxEmojisPerLine]).map{ $0.0 }
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
displayedReactions = reactions
|
|
|
|
displayedReactions = reactions
|
|
|
|
expandButtonReactions = []
|
|
|
|
expandButtonReactions = []
|
|
|
@ -109,7 +110,7 @@ final class ReactionContainerView : UIView {
|
|
|
|
var reactions = self.reactions
|
|
|
|
var reactions = self.reactions
|
|
|
|
while reactions.count > 0 {
|
|
|
|
while reactions.count > 0 {
|
|
|
|
var line: [(String, (Int, Bool))] = []
|
|
|
|
var line: [(String, (Int, Bool))] = []
|
|
|
|
while reactions.count > 0 && line.count < 5 {
|
|
|
|
while reactions.count > 0 && line.count < maxEmojisPerLine {
|
|
|
|
line.append(reactions.removeFirst())
|
|
|
|
line.append(reactions.removeFirst())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
updateCollapsedReactions(line)
|
|
|
|
updateCollapsedReactions(line)
|
|
|
|