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 ## Unreleased
### Changed
- Relax keyboard for host titles.
### Fixed ### Fixed
- In-app purchase unavailable for new providers. [#141](https://github.com/passepartoutvpn/passepartout-ios/issues/141) - 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) ## 1.11.1 (2020-05-11)

View File

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

View File

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

View File

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