Slash more todos (#540)
- Apply some math for keyboard-dance - Onboarding will be reworked nevertheless
This commit is contained in:
parent
26d918a28f
commit
83e0c0e994
|
@ -129,10 +129,12 @@ class MastodonLoginViewController: UIViewController, NeedsDependency {
|
|||
//MARK: - Actions
|
||||
|
||||
@objc func backButtonPressed(_ sender: Any) {
|
||||
contentView.searchTextField.resignFirstResponder()
|
||||
delegate?.backButtonPressed(self)
|
||||
}
|
||||
|
||||
@objc func nextButtonPressed(_ sender: Any) {
|
||||
contentView.searchTextField.resignFirstResponder()
|
||||
delegate?.nextButtonPressed(self)
|
||||
}
|
||||
|
||||
|
@ -230,9 +232,15 @@ class MastodonLoginViewController: UIViewController, NeedsDependency {
|
|||
let duration = userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber
|
||||
else { return }
|
||||
|
||||
//FIXME: @zeitschlag on iPad
|
||||
let adjustmentHeight = keyboardFrameValue.cgRectValue.height - view.safeAreaInsets.bottom
|
||||
contentView.bottomConstraint?.constant = adjustmentHeight
|
||||
// inspired by https://stackoverflow.com/a/30245044
|
||||
let keyboardFrame = keyboardFrameValue.cgRectValue
|
||||
|
||||
let keyboardOrigin = view.convert(keyboardFrame.origin, from: nil)
|
||||
let intersectionY = CGRectGetMaxY(view.frame) - keyboardOrigin.y;
|
||||
|
||||
if intersectionY >= 0 {
|
||||
contentView.bottomConstraint?.constant = intersectionY - view.safeAreaInsets.bottom
|
||||
}
|
||||
|
||||
UIView.animate(withDuration: duration.doubleValue, delay: 0, options: .curveEaseInOut) {
|
||||
self.view.layoutIfNeeded()
|
||||
|
|
|
@ -445,7 +445,6 @@ extension MastodonPickServerViewController: PickServerServerSectionTableHeaderVi
|
|||
}
|
||||
|
||||
func pickServerServerSectionTableHeaderView(_ headerView: PickServerServerSectionTableHeaderView, searchTextDidChange searchText: String?) {
|
||||
//TODO: @zeitschlag Deselect server?
|
||||
viewModel.searchText.send(searchText ?? "")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue