Use a text view in the join open group screen

This commit is contained in:
nielsandriesse 2021-05-05 15:04:18 +10:00 committed by Niels Andriesse
parent c46099735d
commit fb9a27df90

View file

@ -205,8 +205,8 @@ private final class EnterURLVC : UIViewController, UIGestureRecognizerDelegate,
weak var joinOpenGroupVC: JoinOpenGroupVC!
// MARK: Components
private lazy var urlTextField: TextField = {
let result = TextField(placeholder: NSLocalizedString("vc_enter_chat_url_text_field_hint", comment: ""))
private lazy var urlTextView: TextView = {
let result = TextView(placeholder: NSLocalizedString("vc_enter_chat_url_text_field_hint", comment: ""))
result.keyboardType = .URL
result.autocapitalizationType = .none
result.autocorrectionType = .no
@ -244,10 +244,10 @@ private final class EnterURLVC : UIViewController, UIGestureRecognizerDelegate,
// Stack view
let stackView: UIStackView
if Features.useV2OpenGroups {
stackView = UIStackView(arrangedSubviews: [ urlTextField, UIView.spacer(withHeight: Values.mediumSpacing), suggestionGridTitleLabel,
stackView = UIStackView(arrangedSubviews: [ urlTextView, UIView.spacer(withHeight: Values.mediumSpacing), suggestionGridTitleLabel,
UIView.spacer(withHeight: Values.mediumSpacing), suggestionGrid, UIView.vStretchingSpacer(), nextButtonContainer ])
} else {
stackView = UIStackView(arrangedSubviews: [ urlTextField, UIView.vStretchingSpacer(), nextButtonContainer ])
stackView = UIStackView(arrangedSubviews: [ urlTextView, UIView.vStretchingSpacer(), nextButtonContainer ])
}
stackView.axis = .vertical
stackView.alignment = .fill
@ -269,7 +269,7 @@ private final class EnterURLVC : UIViewController, UIGestureRecognizerDelegate,
}
@objc private func dismissKeyboard() {
urlTextField.resignFirstResponder()
urlTextView.resignFirstResponder()
}
// MARK: Interaction
@ -283,7 +283,7 @@ private final class EnterURLVC : UIViewController, UIGestureRecognizerDelegate,
}
@objc private func joinOpenGroup() {
let url = urlTextField.text?.trimmingCharacters(in: .whitespaces) ?? ""
let url = urlTextView.text?.trimmingCharacters(in: .whitespaces) ?? ""
joinOpenGroupVC.joinOpenGroup(with: url)
}
}