Fix layout for small screens

This commit is contained in:
ismailgulek
2020-10-02 14:17:52 +03:00
parent 9280e861ca
commit e050f12182
2 changed files with 82 additions and 97 deletions

View File

@@ -42,6 +42,7 @@ final class EnterPinCodeViewController: UIViewController {
@IBOutlet private weak var informationLabel: UILabel!
@IBOutlet private weak var explanatoryLabel: UILabel!
@IBOutlet private weak var forgotPinButton: UIButton!
@IBOutlet private weak var bottomView: UIView!
// MARK: Private
@@ -160,6 +161,11 @@ final class EnterPinCodeViewController: UIViewController {
}
private func setupViews() {
let cancelBarButtonItem = MXKBarButtonItem(title: VectorL10n.cancel, style: .plain) { [weak self] in
self?.cancelButtonAction()
}
self.navigationItem.rightBarButtonItem = cancelBarButtonItem
showCancelButton()
self.title = ""
@@ -177,15 +183,11 @@ final class EnterPinCodeViewController: UIViewController {
}
private func showCancelButton() {
let cancelBarButtonItem = MXKBarButtonItem(title: VectorL10n.cancel, style: .plain) { [weak self] in
self?.cancelButtonAction()
}
self.navigationItem.rightBarButtonItem = cancelBarButtonItem
self.navigationController?.navigationBar.isHidden = false
}
private func hideCancelButton() {
self.navigationItem.rightBarButtonItem = nil
self.navigationController?.navigationBar.isHidden = true
}
private func render(viewState: EnterPinCodeViewState) {
@@ -224,6 +226,7 @@ final class EnterPinCodeViewController: UIViewController {
self.informationLabel.text = VectorL10n.pinProtectionChoosePin
self.explanatoryLabel.isHidden = false
self.forgotPinButton.isHidden = true
self.bottomView.isHidden = false
self.notAllowedPinView.isHidden = true
}
@@ -242,6 +245,7 @@ final class EnterPinCodeViewController: UIViewController {
self.mainStackView.isHidden = false
self.logoImageView.isHidden = true
self.forgotPinButton.isHidden = true
self.bottomView.isHidden = false
self.notAllowedPinView.isHidden = false
renderPlaceholdersCount(.max, error: true)
@@ -273,8 +277,9 @@ final class EnterPinCodeViewController: UIViewController {
self.mainStackView.isHidden = false
self.logoImageView.isHidden = false
self.informationLabel.text = VectorL10n.pinProtectionEnterPin
self.explanatoryLabel.text = nil
self.explanatoryLabel.isHidden = true
self.forgotPinButton.isHidden = false
self.bottomView.isHidden = true
self.notAllowedPinView.isHidden = true
}
@@ -282,7 +287,7 @@ final class EnterPinCodeViewController: UIViewController {
self.inactiveView.isHidden = true
self.mainStackView.isHidden = false
self.notAllowedPinView.isHidden = true
self.explanatoryLabel.text = nil
self.explanatoryLabel.isHidden = true
self.placeholderStackView.vc_shake()
}
@@ -317,8 +322,9 @@ final class EnterPinCodeViewController: UIViewController {
self.mainStackView.isHidden = false
self.logoImageView.isHidden = true
self.informationLabel.text = VectorL10n.pinProtectionConfirmPinToDisable
self.explanatoryLabel.text = nil
self.explanatoryLabel.isHidden = true
self.forgotPinButton.isHidden = true
self.bottomView.isHidden = false
self.notAllowedPinView.isHidden = true
}
@@ -327,7 +333,7 @@ final class EnterPinCodeViewController: UIViewController {
self.inactiveView.isHidden = false
self.mainStackView.isHidden = true
self.notAllowedPinView.isHidden = true
self.explanatoryLabel.text = nil
self.explanatoryLabel.isHidden = true
}
private func renderPlaceholdersCount(_ count: Int, error: Bool = false) {