diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2021-05-04 15:36:05 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2021-05-04 15:36:05 +0200 |
| commit | 2d72abef52e0b0b38297bf3e11656817e78bfb6a (patch) | |
| tree | 135cc7cda2171fc375be38916d02396413e0e378 | |
| parent | 4a1384722f87b85e4b80509fb99977cbbca2c4a7 (diff) | |
| parent | a156658eec2404d3076b197158020b4909952b4d (diff) | |
| download | mullvadvpn-2d72abef52e0b0b38297bf3e11656817e78bfb6a.tar.xz mullvadvpn-2d72abef52e0b0b38297bf3e11656817e78bfb6a.zip | |
Merge branch 'login-keyboard-accessory-ipad'
| -rw-r--r-- | ios/MullvadVPN/LoginViewController.swift | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/ios/MullvadVPN/LoginViewController.swift b/ios/MullvadVPN/LoginViewController.swift index ae0d1d4e05..c8ef1e58fb 100644 --- a/ios/MullvadVPN/LoginViewController.swift +++ b/ios/MullvadVPN/LoginViewController.swift @@ -88,22 +88,25 @@ class LoginViewController: UIViewController, RootContainment { contentView.bottomAnchor.constraint(equalTo: view.bottomAnchor), ]) - contentView.accountTextField.inputAccessoryView = self.accountInputAccessoryToolbar + contentView.accountTextField.onReturnKey = { [weak self] _ in + guard let self = self else { return true } - // The return key on iPad should behave the same way as "Log in" button in the toolbar - if case .pad = UIDevice.current.userInterfaceIdiom { - contentView.accountTextField.onReturnKey = { [weak self] _ in - guard let self = self else { return true } - - if self.canBeginLogin() { - self.doLogin() - return true - } else { - return false - } + if self.canBeginLogin() { + self.doLogin() + return true + } else { + return false } } + // There is no need to set the input accessory toolbar on iPad since it has a dedicated + // button to dismiss the keyboard. + if case .phone = UIDevice.current.userInterfaceIdiom { + contentView.accountTextField.inputAccessoryView = self.accountInputAccessoryToolbar + } else { + contentView.accountTextField.inputAccessoryView = nil + } + updateDisplayedMessage() updateStatusIcon() updateKeyboardToolbar() |
