Minor refactoring

This commit is contained in:
Niels Andriesse 2021-07-01 16:15:04 +10:00
parent 09de88a14f
commit f0b74c31fa
3 changed files with 7 additions and 3 deletions

View File

@ -295,7 +295,7 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
if !newText.isEmpty {
let lastCharacterIndex = newText.index(before: newText.endIndex)
let lastCharacter = newText[lastCharacterIndex]
// Check if there is a whitespace before the '@' or the '@' is the first character
// Check if there is whitespace before the '@' or the '@' is the first character
let isCharacterBeforeLastWhiteSpaceOrStartOfLine: Bool
if newText.count == 1 {
isCharacterBeforeLastWhiteSpaceOrStartOfLine = true // Start of line

View File

@ -472,7 +472,11 @@ final class VisibleMessageCell : MessageCell, LinkPreviewViewDelegate {
let sign: CGFloat = -1
let x = (damping * (sqrt(abs(translationX)) / sqrt(damping))) * sign
viewsToMove.forEach { $0.transform = CGAffineTransform(translationX: x, y: 0) }
replyButton.alpha = abs(translationX) / VisibleMessageCell.maxBubbleTranslationX
if timerView.isHidden {
replyButton.alpha = abs(translationX) / VisibleMessageCell.maxBubbleTranslationX
} else {
replyButton.alpha = 0 // Always hide the reply button if the timer view is showing, otherwise they can overlap
}
if abs(translationX) > VisibleMessageCell.swipeToReplyThreshold && abs(previousX) < VisibleMessageCell.swipeToReplyThreshold {
UIImpactFeedbackGenerator(style: .heavy).impactOccurred() // Let the user know when they've hit the swipe to reply threshold
}

View File

@ -61,7 +61,7 @@ final class ScrollToBottomButton : UIView {
}
}
protocol ScrollToBottomButtonDelegate : class {
protocol ScrollToBottomButtonDelegate : class {
func handleScrollToBottomButtonTapped()
}