Relax keyboard for host names

This commit is contained in:
Davide De Rosa 2020-05-11 22:53:09 +02:00
parent 452920823c
commit 25ebf4a3eb
4 changed files with 12 additions and 8 deletions

View File

@ -7,10 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Changed
- Relax keyboard for host titles.
### Fixed
- In-app purchase unavailable for new providers. [#141](https://github.com/passepartoutvpn/passepartout-ios/issues/141)
- Hosts may be renamed to same name. [#140](https://github.com/passepartoutvpn/passepartout-ios/issues/140)
- Hosts may be renamed to same title. [#140](https://github.com/passepartoutvpn/passepartout-ios/issues/140)
## 1.11.1 (2020-05-11)

View File

@ -140,10 +140,10 @@ extension UILabel {
}
extension UITextField {
func applyProfileId(_ theme: Theme) {
func applyHostTitle(_ theme: Theme) {
placeholder = L10n.Core.Global.Host.TitleInput.placeholder
clearButtonMode = .always
keyboardType = .asciiCapable
keyboardType = .default
returnKeyType = .done
autocapitalizationType = .none
autocorrectionType = .no

View File

@ -214,7 +214,7 @@ extension WizardHostViewController {
cell.caption = L10n.App.Wizards.Host.Cells.TitleInput.caption
cell.captionWidth = 100.0
// cell.allowedCharset = .filename
cell.field.applyProfileId(.current)
cell.field.applyHostTitle(.current)
cell.delegate = self
return cell

View File

@ -241,7 +241,7 @@ class ServiceViewController: UIViewController, StrongTableHost {
let alert = UIAlertController.asAlert(L10n.Core.Service.Alerts.Rename.title, nil)
alert.addTextField { (field) in
field.text = self.service.screenTitle(ProfileKey(self.uncheckedProfile))
field.applyProfileId(.current)
field.applyHostTitle(.current)
field.delegate = self
}
pendingRenameAction = alert.addPreferredAction(L10n.Core.Global.ok) {
@ -1332,9 +1332,9 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
extension ServiceViewController: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
guard string.rangeOfCharacter(from: CharacterSet.filename.inverted) == nil else {
return false
}
// guard string.rangeOfCharacter(from: CharacterSet.filename.inverted) == nil else {
// return false
// }
if let text = textField.text {
let replacement = (text as NSString).replacingCharacters(in: range, with: string)
pendingRenameAction?.isEnabled = (replacement != uncheckedProfile.id)