Merge branch 'feature/signup' into feature/server-rule
# Conflicts: # Mastodon/Scene/Authentication/Register/MastodonRegisterViewController.swift
This commit is contained in:
commit
abf2e673e1
|
@ -148,7 +148,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency {
|
|||
|
||||
let passwordCheckLabel: UILabel = {
|
||||
let label = UILabel()
|
||||
label.numberOfLines = 4
|
||||
label.numberOfLines = 0
|
||||
return label
|
||||
}()
|
||||
|
||||
|
@ -217,7 +217,7 @@ extension MastodonRegisterViewController {
|
|||
stackView.axis = .vertical
|
||||
stackView.distribution = .fill
|
||||
stackView.spacing = 40
|
||||
stackView.layoutMargins = UIEdgeInsets(top: 20, left: 0, bottom: 0, right: 0)
|
||||
stackView.layoutMargins = UIEdgeInsets(top: 20, left: 0, bottom: 26, right: 0)
|
||||
stackView.isLayoutMarginsRelativeArrangement = true
|
||||
stackView.addArrangedSubview(largeTitleLabel)
|
||||
stackView.addArrangedSubview(photoView)
|
||||
|
@ -309,21 +309,19 @@ extension MastodonRegisterViewController {
|
|||
signUpActivityIndicatorView.centerYAnchor.constraint(equalTo: signUpButton.centerYAnchor),
|
||||
])
|
||||
|
||||
Publishers.CombineLatest3(
|
||||
KeyboardResponderService.shared.isShow.eraseToAnyPublisher(),
|
||||
Publishers.CombineLatest(
|
||||
KeyboardResponderService.shared.state.eraseToAnyPublisher(),
|
||||
KeyboardResponderService.shared.endFrame.eraseToAnyPublisher()
|
||||
KeyboardResponderService.shared.willEndFrame.eraseToAnyPublisher()
|
||||
)
|
||||
.sink(receiveValue: { [weak self] isShow, state, endFrame in
|
||||
.sink(receiveValue: { [weak self] state, endFrame in
|
||||
guard let self = self else { return }
|
||||
|
||||
guard isShow, state == .dock else {
|
||||
guard state == .dock else {
|
||||
self.scrollView.contentInset.bottom = 0.0
|
||||
self.scrollView.verticalScrollIndicatorInsets.bottom = 0.0
|
||||
return
|
||||
}
|
||||
|
||||
// isShow AND dock state
|
||||
let contentFrame = self.view.convert(self.scrollView.frame, to: nil)
|
||||
let padding = contentFrame.maxY - endFrame.minY
|
||||
guard padding > 0 else {
|
||||
|
@ -431,9 +429,10 @@ extension MastodonRegisterViewController: UITextFieldDelegate {
|
|||
// align to password label when overlap
|
||||
if textField === passwordTextField,
|
||||
KeyboardResponderService.shared.isShow.value,
|
||||
KeyboardResponderService.shared.state.value == .dock {
|
||||
let endFrame = KeyboardResponderService.shared.endFrame.value
|
||||
let contentFrame = self.scrollView.convert(self.passwordCheckLabel.frame, to: nil)
|
||||
KeyboardResponderService.shared.state.value == .dock
|
||||
{
|
||||
let endFrame = KeyboardResponderService.shared.willEndFrame.value
|
||||
let contentFrame = scrollView.convert(passwordCheckLabel.frame, to: nil)
|
||||
let padding = contentFrame.maxY - endFrame.minY
|
||||
if padding > 0 {
|
||||
let contentOffsetY = scrollView.contentOffset.y
|
||||
|
|
|
@ -18,7 +18,8 @@ final class KeyboardResponderService {
|
|||
// output
|
||||
let isShow = CurrentValueSubject<Bool, Never>(false)
|
||||
let state = CurrentValueSubject<KeyboardState, Never>(.none)
|
||||
let endFrame = CurrentValueSubject<CGRect, Never>(.zero)
|
||||
let didEndFrame = CurrentValueSubject<CGRect, Never>(.zero)
|
||||
let willEndFrame = CurrentValueSubject<CGRect, Never>(.zero)
|
||||
|
||||
private init() {
|
||||
NotificationCenter.default.publisher(for: UIResponder.keyboardWillShowNotification, object: nil)
|
||||
|
@ -37,6 +38,15 @@ final class KeyboardResponderService {
|
|||
|
||||
NotificationCenter.default.publisher(for: UIResponder.keyboardDidChangeFrameNotification, object: nil)
|
||||
.sink { notification in
|
||||
guard let endFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect else { return }
|
||||
self.didEndFrame.value = endFrame
|
||||
self.updateInternalStatus(notification: notification)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
NotificationCenter.default.publisher(for: UIResponder.keyboardWillChangeFrameNotification, object: nil)
|
||||
.sink { notification in
|
||||
guard let endFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect else { return }
|
||||
self.willEndFrame.value = endFrame
|
||||
self.updateInternalStatus(notification: notification)
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
@ -52,8 +62,6 @@ extension KeyboardResponderService {
|
|||
return
|
||||
}
|
||||
|
||||
self.endFrame.value = endFrame
|
||||
|
||||
guard isLocal else {
|
||||
self.state.value = .notLocal
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue