mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
add tap gesture
This commit is contained in:
parent
6aa37d4d98
commit
8ad21ba089
1 changed files with 18 additions and 1 deletions
|
@ -19,6 +19,9 @@ final class NewConversationVC: BaseVC, UITableViewDelegate, UITableViewDataSourc
|
|||
lineBottom.set(.height, to: 0.5)
|
||||
lineBottom.backgroundColor = Colors.border.withAlphaComponent(0.3)
|
||||
|
||||
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleTap))
|
||||
tapGestureRecognizer.numberOfTapsRequired = 1
|
||||
|
||||
let result = UIStackView(
|
||||
arrangedSubviews: [
|
||||
lineTop,
|
||||
|
@ -29,6 +32,7 @@ final class NewConversationVC: BaseVC, UITableViewDelegate, UITableViewDataSourc
|
|||
]
|
||||
)
|
||||
result.axis = .vertical
|
||||
result.addGestureRecognizer(tapGestureRecognizer)
|
||||
return result
|
||||
}()
|
||||
|
||||
|
@ -71,7 +75,7 @@ final class NewConversationVC: BaseVC, UITableViewDelegate, UITableViewDataSourc
|
|||
buttonStackViewContainer.backgroundColor = Colors.cellBackground
|
||||
view.addSubview(buttonStackViewContainer)
|
||||
buttonStackViewContainer.pin([ UIView.HorizontalEdge.leading, UIView.HorizontalEdge.trailing ], to: view)
|
||||
buttonStackViewContainer.pin(.top, to: .top, of: view, withInset: Values.mediumSpacing)
|
||||
buttonStackViewContainer.pin(.top, to: .top, of: view, withInset: Values.smallSpacing)
|
||||
|
||||
view.addSubview(contactsTitleLabel)
|
||||
contactsTitleLabel.pin(.leading, to: .leading, of: view, withInset: Values.mediumSpacing)
|
||||
|
@ -114,6 +118,19 @@ final class NewConversationVC: BaseVC, UITableViewDelegate, UITableViewDataSourc
|
|||
|
||||
// MARK: - Interaction
|
||||
|
||||
@objc private func handleTap(_ gestureRecognizer: UITapGestureRecognizer) {
|
||||
let location = gestureRecognizer.location(in: self.view)
|
||||
if newDMButton.frame.contains(location) {
|
||||
createNewDM()
|
||||
}
|
||||
else if newGroupButton.frame.contains(location) {
|
||||
createClosedGroup()
|
||||
}
|
||||
else if joinCommunityButton.frame.contains(location) {
|
||||
joinOpenGroup()
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func close() {
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue