Merge pull request #357 from mastodon/fix-issue-353

Fix issue 353
This commit is contained in:
CMK 2022-04-02 10:54:05 +08:00 committed by GitHub
commit 909acdcfa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 68 deletions

View File

@ -115,6 +115,7 @@ extension MastodonRegisterTextFieldTableViewCell {
label.font = MastodonRegisterTextFieldTableViewCell.textFieldLabelFont
label.textColor = Asset.Colors.Label.primary.color
label.text = text
label.lineBreakMode = .byTruncatingMiddle
label.translatesAutoresizingMaskIntoConstraints = false
containerView.addSubview(label)
@ -123,6 +124,7 @@ extension MastodonRegisterTextFieldTableViewCell {
label.leadingAnchor.constraint(equalTo: paddingView.trailingAnchor),
containerView.trailingAnchor.constraint(equalTo: label.trailingAnchor, constant: 16),
label.bottomAnchor.constraint(equalTo: containerView.bottomAnchor),
label.widthAnchor.constraint(lessThanOrEqualToConstant: 180).priority(.required - 1),
])
return containerView
}()

View File

@ -11,6 +11,7 @@ import MastodonSDK
import os.log
import PhotosUI
import UIKit
import MastodonUI
import MastodonAsset
import MastodonLocalization
@ -132,12 +133,12 @@ extension MastodonRegisterViewController {
viewModel.setupDiffableDataSource(tableView: tableView)
// KeyboardResponderService
// .configure(
// scrollView: tableView,
// layoutNeedsUpdate: viewModel.viewDidAppear.eraseToAnyPublisher()
// )
// .store(in: &disposeBag)
KeyboardResponderService
.configure(
scrollView: tableView,
layoutNeedsUpdate: viewModel.viewDidAppear.eraseToAnyPublisher()
)
.store(in: &disposeBag)
// gesture
view.addGestureRecognizer(tapGestureRecognizer)
@ -403,65 +404,3 @@ extension MastodonRegisterViewController {
}
}
extension MastodonRegisterViewController: UITextFieldDelegate {
// func textFieldDidBeginEditing(_ textField: UITextField) {
// let text = textField.text?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
//
// switch textField {
// case usernameTextField:
// viewModel.username.value = text
// case displayNameTextField:
// viewModel.displayName.value = text
// case emailTextField:
// viewModel.email.value = text
// case passwordTextField:
// viewModel.password.value = text
// case reasonTextField:
// viewModel.reason.value = text
// default:
// break
// }
// }
//
// func textFieldDidEndEditing(_ textField: UITextField) {
// let text = textField.text?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
//
// switch textField {
// case usernameTextField:
// viewModel.username.value = text
// case displayNameTextField:
// viewModel.displayName.value = text
// case emailTextField:
// viewModel.email.value = text
// case passwordTextField:
// viewModel.password.value = text
// case reasonTextField:
// viewModel.reason.value = text
// default:
// break
// }
// }
//
// func textFieldShouldReturn(_ textField: UITextField) -> Bool {
// switch textField {
// case usernameTextField:
// displayNameTextField.becomeFirstResponder()
// case displayNameTextField:
// emailTextField.becomeFirstResponder()
// case emailTextField:
// passwordTextField.becomeFirstResponder()
// case passwordTextField:
// if viewModel.approvalRequired {
// reasonTextField.becomeFirstResponder()
// } else {
// passwordTextField.resignFirstResponder()
// }
// case reasonTextField:
// reasonTextField.resignFirstResponder()
// default:
// break
// }
// return true
// }
}