From 25ebf4a3ebc33d192ec4f40ba1cd5af017734882 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Mon, 11 May 2020 22:53:09 +0200 Subject: [PATCH] Relax keyboard for host names --- CHANGELOG.md | 6 +++++- Passepartout-iOS/Global/Theme.swift | 4 ++-- .../Scenes/Organizer/WizardHostViewController.swift | 2 +- Passepartout-iOS/Scenes/ServiceViewController.swift | 8 ++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de2f29b6..c0e9607c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/Passepartout-iOS/Global/Theme.swift b/Passepartout-iOS/Global/Theme.swift index c2decd79..6f76bfb5 100644 --- a/Passepartout-iOS/Global/Theme.swift +++ b/Passepartout-iOS/Global/Theme.swift @@ -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 diff --git a/Passepartout-iOS/Scenes/Organizer/WizardHostViewController.swift b/Passepartout-iOS/Scenes/Organizer/WizardHostViewController.swift index 74fbf031..a5305eac 100644 --- a/Passepartout-iOS/Scenes/Organizer/WizardHostViewController.swift +++ b/Passepartout-iOS/Scenes/Organizer/WizardHostViewController.swift @@ -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 diff --git a/Passepartout-iOS/Scenes/ServiceViewController.swift b/Passepartout-iOS/Scenes/ServiceViewController.swift index 38ac087d..b0121253 100644 --- a/Passepartout-iOS/Scenes/ServiceViewController.swift +++ b/Passepartout-iOS/Scenes/ServiceViewController.swift @@ -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)