mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.4 KiB
Swift
41 lines
1.4 KiB
Swift
4 years ago
|
|
||
|
final class MessagesTableView : UITableView {
|
||
|
var keyboardHeight: CGFloat = 0
|
||
4 years ago
|
|
||
|
// Overriding contentInset and adjustedContentInset is to keep them from changing when the
|
||
|
// conversation view controller is dismissed.
|
||
|
|
||
4 years ago
|
override var contentInset: UIEdgeInsets {
|
||
|
get { UIEdgeInsets(top: 0, leading: 0, bottom: MessagesTableView.baselineContentInset + keyboardHeight, trailing: 0) }
|
||
|
set { }
|
||
|
}
|
||
|
|
||
|
override var adjustedContentInset: UIEdgeInsets {
|
||
|
get { UIEdgeInsets(top: 0, leading: 0, bottom: MessagesTableView.baselineContentInset + keyboardHeight, trailing: 0) }
|
||
|
set { }
|
||
|
}
|
||
|
|
||
|
private static let baselineContentInset = Values.mediumSpacing
|
||
|
|
||
|
override init(frame: CGRect, style: UITableView.Style) {
|
||
|
super.init(frame: frame, style: style)
|
||
|
initialize()
|
||
|
}
|
||
|
|
||
|
required init?(coder: NSCoder) {
|
||
|
super.init(coder: coder)
|
||
|
initialize()
|
||
|
}
|
||
|
|
||
|
private func initialize() {
|
||
|
register(VisibleMessageCell.self, forCellReuseIdentifier: VisibleMessageCell.identifier)
|
||
|
register(InfoMessageCell.self, forCellReuseIdentifier: InfoMessageCell.identifier)
|
||
4 years ago
|
register(TypingIndicatorCell.self, forCellReuseIdentifier: TypingIndicatorCell.identifier)
|
||
4 years ago
|
separatorStyle = .none
|
||
|
backgroundColor = .clear
|
||
|
showsVerticalScrollIndicator = false
|
||
|
contentInsetAdjustmentBehavior = .never
|
||
|
keyboardDismissMode = .interactive
|
||
|
}
|
||
|
}
|