diff --git a/MoppApp/MoppApp/DefaultsHelper.swift b/MoppApp/MoppApp/DefaultsHelper.swift index cf8821d4f..9914df9d3 100644 --- a/MoppApp/MoppApp/DefaultsHelper.swift +++ b/MoppApp/MoppApp/DefaultsHelper.swift @@ -80,7 +80,6 @@ fileprivate let kSivaAccessState = "kSivaAccessState" fileprivate let kSivaUrl = "kSivaUrl" fileprivate let kSivaFileCertName = "kSivaFileCertName" fileprivate let kProxySetting = "kProxySetting" -fileprivate let kIsProxyForSSLEnabled = "kIsProxyForSSLEnabled" fileprivate let kProxyHost = "kProxyHost" fileprivate let kProxyPort = "kProxyPort" fileprivate let kProxyUsername = "kProxyUsername" @@ -93,8 +92,7 @@ class DefaultsHelper kFirstStartKey: true, kSettingsDefaultSwitchKey: true, kMobileIdRememberMeKey: true, - kSmartIdRememberMeKey: true, - kIsProxyForSSLEnabled: true + kSmartIdRememberMeKey: true ] ) } @@ -364,15 +362,6 @@ class DefaultsHelper } } - class var isProxyForSSLEnabled: Bool { - set { - UserDefaults.standard.set(newValue, forKey: kIsProxyForSSLEnabled) - } - get { - return UserDefaults.standard.bool(forKey: kIsProxyForSSLEnabled) - } - } - class var proxyHost: String? { set { UserDefaults.standard.set(newValue, forKey: kProxyHost) diff --git a/MoppApp/MoppApp/LocalizationKeys.swift b/MoppApp/MoppApp/LocalizationKeys.swift index b61237e9e..429238cc3 100644 --- a/MoppApp/MoppApp/LocalizationKeys.swift +++ b/MoppApp/MoppApp/LocalizationKeys.swift @@ -324,7 +324,6 @@ enum LocKey : String case settingsProxyPort = "settings-proxy-port" case settingsProxyUsername = "settings-proxy-username" case settingsProxyPassword = "settings-proxy-password" - case settingsProxyAllowSSL = "settings-proxy-allow-ssl" case settingsSivaDefaultAccessTitle = "settings-siva-default-access-title" case settingsSivaDefaultManualAccessTitle = "settings-siva-default-manual-access-title" case settingsSivaDefaultCertificateTitle = "settings-siva-default-certificate-title" @@ -496,6 +495,7 @@ enum LocKey : String case voiceControlRoleCountry = "voice-control-role-country"; case voiceControlRoleZip = "voice-control-role-zip"; case voiceControlRoleAndAddress = "voice-control-role-and-address"; + case voiceControlSivaCategory = "voice-control-siva-category"; case voiceControlSivaService = "voice-control-siva-service"; case voiceControlSivaDefaultAccess = "voice-control-siva-default-access"; case voiceControlSivaManualAccess = "voice-control-siva-manual-access"; diff --git a/MoppApp/MoppApp/ManualProxy.swift b/MoppApp/MoppApp/ManualProxy.swift index d15b295a1..81e2f213a 100644 --- a/MoppApp/MoppApp/ManualProxy.swift +++ b/MoppApp/MoppApp/ManualProxy.swift @@ -32,12 +32,11 @@ public class ManualProxy { host: DefaultsHelper.proxyHost ?? "", port: DefaultsHelper.proxyPort, username: DefaultsHelper.proxyUsername ?? "", - password: KeychainUtil.retrieve(key: proxyPasswordKey) ?? "", - isSSLEnabled: DefaultsHelper.isProxyForSSLEnabled) + password: KeychainUtil.retrieve(key: proxyPasswordKey) ?? "") } public static func getMoppLibProxyConfiguration() -> MoppLibProxyConfiguration { let manualProxy = ManualProxy.getManualProxyConfiguration() - return MoppLibProxyConfiguration(configuration: manualProxy.host, port: NSNumber(value: manualProxy.port), username: manualProxy.username, password: manualProxy.password, issslenabled: manualProxy.isSSLEnabled) + return MoppLibProxyConfiguration(configuration: manualProxy.host, port: NSNumber(value: manualProxy.port), username: manualProxy.username, password: manualProxy.password) } } diff --git a/MoppApp/MoppApp/ProxyViewController.swift b/MoppApp/MoppApp/ProxyViewController.swift index 8d861dd07..23b28029f 100644 --- a/MoppApp/MoppApp/ProxyViewController.swift +++ b/MoppApp/MoppApp/ProxyViewController.swift @@ -22,10 +22,47 @@ */ import UIKit +import SkSigningLib -class ProxyViewController: MoppViewController { - - @IBOutlet weak var tableView: UITableView! +class ProxyViewController: MoppViewController, UITextFieldDelegate { + + @IBOutlet weak var scrollView: UIScrollView! + + @IBOutlet weak var proxyTitle: ScaledLabel! + @IBOutlet weak var dismissButton: ScaledButton! + + @IBOutlet weak var useNoProxyStackView: UIStackView! + @IBOutlet weak var useSystemProxyStackView: UIStackView! + @IBOutlet weak var useManualProxyStackView: UIStackView! + + @IBOutlet weak var useNoProxyView: UIView! + @IBOutlet weak var useSystemProxyView: UIView! + @IBOutlet weak var useManualProxyView: UIView! + + @IBOutlet weak var useNoProxyRadioButton: RadioButton! + @IBOutlet weak var useSystemProxyRadioButton: RadioButton! + @IBOutlet weak var useManualProxyRadioButton: RadioButton! + + @IBOutlet weak var useNoProxyLabel: ScaledLabel! + @IBOutlet weak var useSystemProxyLabel: ScaledLabel! + @IBOutlet weak var useManualProxyLabel: ScaledLabel! + + @IBOutlet weak var hostLabel: ScaledLabel! + @IBOutlet weak var hostTextField: SettingsTextField! + + @IBOutlet weak var portLabel: ScaledLabel! + @IBOutlet weak var portTextField: SettingsTextField! + @IBOutlet weak var portErrorLabel: ScaledLabel! + + @IBOutlet weak var usernameLabel: ScaledLabel! + @IBOutlet weak var usernameTextField: SettingsTextField! + + @IBOutlet weak var passwordLabel: ScaledLabel! + @IBOutlet weak var passwordTextField: SettingsTextField! + + @IBAction func dismissView(_ sender: ScaledButton) { + dismiss(animated: true) + } var currentlyEditingCell: IndexPath? var currentlyEditingField: UITextField? @@ -51,71 +88,290 @@ class ProxyViewController: MoppViewController { } override func keyboardWillShow(notification: NSNotification) { - tableView.setContentOffset(CGPoint(x: 0, y: (currentlyEditingField?.frame.origin.y ?? 0)), animated: true) +// tableView.setContentOffset(CGPoint(x: 0, y: (currentlyEditingField?.frame.origin.y ?? 0)), animated: true) } override func keyboardWillHide(notification: NSNotification) { - tableView.setContentOffset(CGPoint(x: 0, y: 0), animated: true) +// tableView.setContentOffset(CGPoint(x: 0, y: 0), animated: true) } -} + + override func viewDidLoad() { + super.viewDidLoad() -extension ProxyViewController: UITableViewDelegate, UITableViewDataSource { - func numberOfSections(in tableView: UITableView) -> Int { - return sections.count + hostTextField.delegate = self + portTextField.delegate = self + usernameTextField.delegate = self + passwordTextField.delegate = self + + dismissButton.setTitle(L(.closeButton)) + + useNoProxyLabel.text = L(.settingsProxyNoProxy) + useSystemProxyLabel.text = L(.settingsProxyUseSystem) + useManualProxyLabel.text = L(.settingsProxyUseManual) + + presentDismissButton(hostTextField) + presentDismissButton(portTextField) + presentDismissButton(usernameTextField) + presentDismissButton(passwordTextField) + + setBorder(hostTextField) + setBorder(portTextField) + setBorder(usernameTextField) + setBorder(passwordTextField) + + hostTextField.isAccessibilityElement = true + portTextField.isAccessibilityElement = true + usernameTextField.isAccessibilityElement = true + passwordTextField.isAccessibilityElement = true + + hostTextField.accessibilityLabel = L(.settingsProxyHost) + portTextField.accessibilityLabel = L(.settingsProxyPort) + usernameTextField.accessibilityLabel = L(.settingsProxyUsername) + passwordTextField.accessibilityLabel = L(.settingsProxyPassword) + + hostTextField.accessibilityUserInputLabels = [L(.voiceControlProxyHost)] + portTextField.accessibilityUserInputLabels = [L(.voiceControlProxyPort)] + usernameTextField.accessibilityUserInputLabels = [L(.voiceControlProxyUsername)] + passwordTextField.accessibilityUserInputLabels = [L(.voiceControlProxyPassword)] + + useNoProxyView.accessibilityUserInputLabels = [L(.voiceControlProxyNoProxy)] + useSystemProxyView.accessibilityUserInputLabels = [L(.voiceControlProxySystemProxy)] + useManualProxyView.accessibilityUserInputLabels = [L(.voiceControlProxyManualProxy)] + + guard let dismissButton = dismissButton, let proxyUITitle = proxyTitle, let noProxyUIView = useNoProxyStackView, let systemProxyUIView = useSystemProxyStackView, let manualProxyUIView = useManualProxyStackView, let hostUITextField: UITextField = hostTextField, let portUITextField = portTextField, let usernameUITextField = usernameTextField, let passwordUITextField = passwordTextField else { + printLog("Unable to get proxyTitle, useNoProxyView, useSystemProxyView, useManualProxyView, hostTextField, portTextField, usernameTextField, passwordTextField") + return + } + + if UIAccessibility.isVoiceOverRunning { + self.accessibilityElements = [proxyUITitle, dismissButton, noProxyUIView, systemProxyUIView, manualProxyUIView, hostUITextField, portUITextField, usernameUITextField, passwordUITextField] + } + + updateUI() + } + + func setAccessibilityElementsInStackView(stackView: UIStackView, isAccessibilityElement: Bool) { + for subview in stackView.arrangedSubviews { + subview.isAccessibilityElement = isAccessibilityElement + } } - func tableView(_ tableView: UITableView, numberOfRowsInSection section_: Int) -> Int { - switch sections[section_] { - case .header: - return 1 - case .fields: - return fields.count + + func handleProxySetting(proxySetting: ProxySetting) { + switch proxySetting { + case .noProxy: + self.useNoProxyRadioButton.setSelectedState(state: true) + self.useSystemProxyRadioButton.setSelectedState(state: false) + self.useManualProxyRadioButton.setSelectedState(state: false) + + DefaultsHelper.proxySetting = .noProxy + + self.hostTextField.isEnabled = false + self.portTextField.isEnabled = false + self.usernameTextField.isEnabled = false + self.passwordTextField.isEnabled = false + + self.hostTextField.textColor = .lightGray + self.portTextField.textColor = .lightGray + self.usernameTextField.textColor = .lightGray + self.passwordTextField.textColor = .lightGray + + case .systemProxy: + self.useNoProxyRadioButton.setSelectedState(state: false) + self.useSystemProxyRadioButton.setSelectedState(state: true) + self.useManualProxyRadioButton.setSelectedState(state: false) + + DefaultsHelper.proxySetting = .systemProxy + + self.hostTextField.isEnabled = false + self.portTextField.isEnabled = false + self.usernameTextField.isEnabled = false + self.passwordTextField.isEnabled = false + + self.hostTextField.textColor = .lightGray + self.portTextField.textColor = .lightGray + self.usernameTextField.textColor = .lightGray + self.passwordTextField.textColor = .lightGray + + case .manualProxy: + self.useNoProxyRadioButton.setSelectedState(state: false) + self.useSystemProxyRadioButton.setSelectedState(state: false) + self.useManualProxyRadioButton.setSelectedState(state: true) + + DefaultsHelper.proxySetting = .manualProxy + + self.hostTextField.isEnabled = true + self.portTextField.isEnabled = true + self.usernameTextField.isEnabled = true + self.passwordTextField.isEnabled = true + + self.hostTextField.textColor = .black + self.portTextField.textColor = .black + self.usernameTextField.textColor = .black + self.passwordTextField.textColor = .black } } - func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { - return UITableView.automaticDimension - } - - func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - tableView.estimatedRowHeight = 44 - return UITableView.automaticDimension - } - - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - switch sections[indexPath.section] { - case .header: - let headerCell = tableView.dequeueReusableCell(withType: SettingsHeaderCell.self, for: indexPath)! - headerCell.delegate = self - headerCell.populate(with: " ") - headerCell.titleLabel.isAccessibilityElement = false - return headerCell - case .fields: - let field = fields[indexPath.row] - switch field { - case .proxy: - let proxyCell = tableView.dequeueReusableCell(withType: SettingsProxyCell.self, for: indexPath)! - proxyCell.topViewController = getTopViewController() - proxyCell.delegate = self - proxyCell.populate() - return proxyCell + @objc func handleState(_ sender: ProxyChoiceTapGestureRecognizer) { + handleProxySetting(proxySetting: sender.proxySetting) + } + + func updateUI() { + DispatchQueue.main.async { + +// self.proxyChoicesStackView.isAccessibilityElement = false + +// self.setAccessibilityElementsInStackView(stackView: self.proxyChoicesStackView, isAccessibilityElement: true) + + let savedProxySetting = DefaultsHelper.proxySetting + self.useNoProxyRadioButton.setSelectedState(state: savedProxySetting == .noProxy) + self.useSystemProxyRadioButton.setSelectedState(state: savedProxySetting == .systemProxy) + self.useManualProxyRadioButton.setSelectedState(state: savedProxySetting == .manualProxy) + + self.hostTextField.text = DefaultsHelper.proxyHost + self.portTextField.text = String(DefaultsHelper.proxyPort) + self.usernameTextField.text = DefaultsHelper.proxyUsername + self.passwordTextField.text = KeychainUtil.retrieve(key: proxyPasswordKey) ?? "" + + // Detect which RadioButton was clicked + if !(self.useNoProxyView.gestureRecognizers?.contains(where: { $0 is ProxyChoiceTapGestureRecognizer }) ?? false) { + + let tapGesture = ProxyChoiceTapGestureRecognizer(target: self, action: #selector(self.handleState(_:))) + tapGesture.proxySetting = .noProxy + self.useNoProxyView.addGestureRecognizer(tapGesture) + self.useNoProxyView.isUserInteractionEnabled = true + } + + if !(self.useSystemProxyView.gestureRecognizers?.contains(where: { $0 is ProxyChoiceTapGestureRecognizer }) ?? false) { + + let tapGesture = ProxyChoiceTapGestureRecognizer(target: self, action: #selector(self.handleState(_:))) + tapGesture.proxySetting = .systemProxy + self.useSystemProxyView.addGestureRecognizer(tapGesture) + self.useSystemProxyView.isUserInteractionEnabled = true } + + if !(self.useManualProxyView.gestureRecognizers?.contains(where: { $0 is ProxyChoiceTapGestureRecognizer }) ?? false) { + let tapGesture = ProxyChoiceTapGestureRecognizer(target: self, action: #selector(self.handleState(_:))) + tapGesture.proxySetting = .manualProxy + self.useManualProxyView.addGestureRecognizer(tapGesture) + self.useManualProxyView.isUserInteractionEnabled = true + } + + if let number = Int(self.portTextField.text ?? ""), self.isPortNumberValid(portNumber: number) { + self.portErrorLabel.isHidden = true + } else { + self.portErrorLabel.isHidden = false + } + + self.useNoProxyView.isAccessibilityElement = true + self.useSystemProxyView.isAccessibilityElement = true + self.useManualProxyView.isAccessibilityElement = true + + self.useNoProxyView.accessibilityLabel = L(.settingsProxyNoProxy) + self.useSystemProxyView.accessibilityLabel = L(.settingsProxyUseSystem) + self.useManualProxyView.accessibilityLabel = L(.settingsProxyUseManual) + + self.proxyTitle.text = L(.settingsProxyTitle) + + self.useNoProxyLabel.text = L(.settingsProxyNoProxy) + self.useSystemProxyLabel.text = L(.settingsProxyUseSystem) + self.useManualProxyLabel.text = L(.settingsProxyUseManual) + + self.hostLabel.text = L(.settingsProxyHost) + self.portLabel.text = L(.settingsProxyPort) + self.usernameLabel.text = L(.settingsProxyUsername) + self.passwordLabel.text = L(.settingsProxyPassword) + + self.handleProxySetting(proxySetting: savedProxySetting) } } - @objc func editingChanged(sender: UITextField) { - let text = sender.text ?? String() - if (text.count > 11) { - sender.deleteBackward() + func presentDismissButton(_ textField: SettingsTextField) { + textField.moppPresentDismissButton() + } + + func setBorder(_ textField: SettingsTextField) { + textField.layer.borderColor = UIColor.moppContentLine.cgColor + textField.layer.borderWidth = 1 + } + + func isPortNumberValid(portNumber: Int) -> Bool { + return (1...65535).contains(portNumber) + } + + deinit { + let savedProxySetting = DefaultsHelper.proxySetting + if savedProxySetting == .noProxy || savedProxySetting == .systemProxy { + DefaultsHelper.proxyHost = "" + DefaultsHelper.proxyPort = 80 + DefaultsHelper.proxyUsername = "" + KeychainUtil.remove(key: proxyPasswordKey) } + printLog("Deinit SettingsProxyCell") } + + + + } -extension ProxyViewController: SettingsHeaderCellDelegate { - func didDismissSettings() { - dismiss(animated: true, completion: nil) - } -} +//extension ProxyViewController: UITableViewDelegate, UITableViewDataSource { +// func numberOfSections(in tableView: UITableView) -> Int { +// return sections.count +// } +// +// func tableView(_ tableView: UITableView, numberOfRowsInSection section_: Int) -> Int { +// switch sections[section_] { +// case .header: +// return 1 +// case .fields: +// return fields.count +// } +// } +// +// func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { +// return UITableView.automaticDimension +// } +// +// func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { +// tableView.estimatedRowHeight = 44 +// return UITableView.automaticDimension +// } +// +// func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { +// switch sections[indexPath.section] { +// case .header: +// let headerCell = tableView.dequeueReusableCell(withType: SettingsHeaderCell.self, for: indexPath)! +// headerCell.delegate = self +// headerCell.populate(with: " ") +// headerCell.titleLabel.isAccessibilityElement = false +// return headerCell +// case .fields: +// let field = fields[indexPath.row] +// switch field { +// case .proxy: +// let proxyCell = tableView.dequeueReusableCell(withType: SettingsProxyCell.self, for: indexPath)! +// proxyCell.topViewController = getTopViewController() +// proxyCell.delegate = self +// proxyCell.populate() +// return proxyCell +// } +// } +// } +// +// @objc func editingChanged(sender: UITextField) { +// let text = sender.text ?? String() +// if (text.count > 11) { +// sender.deleteBackward() +// } +// } +//} + +//extension ProxyViewController: SettingsHeaderCellDelegate { +// func didDismissSettings() { +// dismiss(animated: true, completion: nil) +// } +//} extension ProxyViewController: SettingsCellDelegate { func didStartEditingField(_ field: SigningCategoryViewController.FieldId, _ textField: UITextField) { diff --git a/MoppApp/MoppApp/Settings.storyboard b/MoppApp/MoppApp/Settings.storyboard index cdc782e56..c63912dad 100644 --- a/MoppApp/MoppApp/Settings.storyboard +++ b/MoppApp/MoppApp/Settings.storyboard @@ -354,7 +354,7 @@ - + @@ -643,8 +643,10 @@ + + @@ -657,11 +659,11 @@ - + - + + - + @@ -855,10 +858,10 @@ - + - + @@ -1119,14 +1122,14 @@ - + - + @@ -1184,11 +1187,13 @@ + + @@ -1207,482 +1212,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2159,6 +1688,440 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MoppApp/MoppApp/SettingsProxyCell.swift b/MoppApp/MoppApp/SettingsProxyCell.swift index 19ff7dacf..7f4e64cb0 100644 --- a/MoppApp/MoppApp/SettingsProxyCell.swift +++ b/MoppApp/MoppApp/SettingsProxyCell.swift @@ -25,8 +25,6 @@ import UIKit import SkSigningLib class SettingsProxyCell: UITableViewCell { - - private static let defaultEnableSSLWidth = CGFloat(150) @IBOutlet weak var proxyTitle: ScaledLabel! @@ -58,19 +56,10 @@ class SettingsProxyCell: UITableViewCell { @IBOutlet weak var passwordTitle: ScaledLabel! @IBOutlet weak var passwordTextField: SettingsTextField! - @IBOutlet weak var enableSSLStackView: UIStackView! - @IBOutlet weak var enableSSLTitle: ScaledLabel! - @IBOutlet weak var enableSSLButton: SwitchButton! - weak var delegate: SettingsCellDelegate! weak var topViewController: UIViewController? - @IBAction func toggleProxySSL(_ sender: SwitchButton) { - DefaultsHelper.isProxyForSSLEnabled = sender.isOn - setSSLButtonVoiceLabel() - } - override func awakeFromNib() { hostTextField.delegate = self portTextField.delegate = self @@ -109,16 +98,14 @@ class SettingsProxyCell: UITableViewCell { noProxyView.accessibilityUserInputLabels = [L(.voiceControlProxyNoProxy)] systemProxyView.accessibilityUserInputLabels = [L(.voiceControlProxySystemProxy)] manualProxyView.accessibilityUserInputLabels = [L(.voiceControlProxyManualProxy)] - - setSSLButtonVoiceLabel() - guard let proxyUITitle = proxyTitle, let noProxyUIView = noProxyView, let systemProxyUIView = systemProxyView, let manualProxyUIView = manualProxyView, let hostUITextField: UITextField = hostTextField, let portUITextField = portTextField, let usernameUITextField = usernameTextField, let passwordUITextField = passwordTextField, let enableSSLUIButton = enableSSLButton else { - printLog("Unable to get proxyTitle, noProxyView, systemProxyView, manualProxyView, hostTextField, portTextField, usernameTextField, passwordTextField or enableSSLButton") + guard let proxyUITitle = proxyTitle, let noProxyUIView = noProxyView, let systemProxyUIView = systemProxyView, let manualProxyUIView = manualProxyView, let hostUITextField: UITextField = hostTextField, let portUITextField = portTextField, let usernameUITextField = usernameTextField, let passwordUITextField = passwordTextField else { + printLog("Unable to get proxyTitle, noProxyView, systemProxyView, manualProxyView, hostTextField, portTextField, usernameTextField, passwordTextField") return } if UIAccessibility.isVoiceOverRunning { - self.accessibilityElements = [proxyUITitle, noProxyUIView, systemProxyUIView, manualProxyUIView, hostUITextField, portUITextField, usernameUITextField, passwordUITextField, enableSSLUIButton] + self.accessibilityElements = [proxyUITitle, noProxyUIView, systemProxyUIView, manualProxyUIView, hostUITextField, portUITextField, usernameUITextField, passwordUITextField] } updateUI() @@ -197,9 +184,6 @@ class SettingsProxyCell: UITableViewCell { DispatchQueue.main.async { self.proxyChoicesStackView.isAccessibilityElement = false - self.enableSSLStackView.isAccessibilityElement = false - - self.enableSSLButton.isAccessibilityElement = true self.setAccessibilityElementsInStackView(stackView: self.proxyChoicesStackView, isAccessibilityElement: true) @@ -213,9 +197,6 @@ class SettingsProxyCell: UITableViewCell { self.usernameTextField.text = DefaultsHelper.proxyUsername self.passwordTextField.text = KeychainUtil.retrieve(key: proxyPasswordKey) ?? "" - self.enableSSLButton.isOn = DefaultsHelper.isProxyForSSLEnabled - self.enableSSLButton.accessibilityLabel = L(.settingsProxyAllowSSL) - // Detect which RadioButton was clicked if !(self.noProxyView.gestureRecognizers?.contains(where: { $0 is ProxyChoiceTapGestureRecognizer }) ?? false) { @@ -265,8 +246,6 @@ class SettingsProxyCell: UITableViewCell { self.usernameTitle.text = L(.settingsProxyUsername) self.passwordTitle.text = L(.settingsProxyPassword) - self.enableSSLTitle.text = L(.settingsProxyAllowSSL) - self.handleProxySetting(proxySetting: savedProxySetting) } } @@ -284,10 +263,6 @@ class SettingsProxyCell: UITableViewCell { return (1...65535).contains(portNumber) } - func setSSLButtonVoiceLabel() { - enableSSLButton.accessibilityUserInputLabels = enableSSLButton.isOn ? [L(.voiceControlProxyDisallowSsl)] : [L(.settingsProxyAllowSSL)] - } - deinit { let savedProxySetting = DefaultsHelper.proxySetting if savedProxySetting == .noProxy || savedProxySetting == .systemProxy { diff --git a/MoppApp/MoppApp/SettingsTSACertCell.swift b/MoppApp/MoppApp/SettingsTSACertCell.swift index feda3a34d..68a68494a 100644 --- a/MoppApp/MoppApp/SettingsTSACertCell.swift +++ b/MoppApp/MoppApp/SettingsTSACertCell.swift @@ -43,6 +43,9 @@ class SettingsTSACertCell: UITableViewCell { @IBOutlet weak var addCertificateButton: ScaledLabel! @IBOutlet weak var showCertificateButton: ScaledLabel! + @IBOutlet weak var addCertificateView: UIView! + @IBOutlet weak var showCertificateView: UIView! + @objc func addCertificateButtonTapped() { let documentPicker: UIDocumentPickerViewController = { let allowedDocumentTypes = [UTType.x509Certificate] @@ -112,6 +115,8 @@ class SettingsTSACertCell: UITableViewCell { self.addCertificateButton.resetLabelProperties() self.addCertificateButton.isAccessibilityElement = true + self.addCertificateView.accessibilityUserInputLabels = [L(.settingsTimestampCertAddCertificateButton)] + self.showCertificateButton.text = L(.settingsTimestampCertShowCertificateButton) self.showCertificateButton.accessibilityLabel = self.showCertificateButton.text?.lowercased() self.showCertificateButton.font = .moppMedium @@ -120,6 +125,8 @@ class SettingsTSACertCell: UITableViewCell { self.showCertificateButton.resetLabelProperties() self.showCertificateButton.isAccessibilityElement = true + self.showCertificateView.accessibilityUserInputLabels = [L(.settingsTimestampCertShowCertificateButton)] + if self.addCertificateButton.gestureRecognizers == nil || self.addCertificateButton.gestureRecognizers?.isEmpty == true { let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.addCertificateButtonTapped)) self.addCertificateButton.addGestureRecognizer(tapGesture) diff --git a/MoppApp/MoppApp/SettingsViewController.swift b/MoppApp/MoppApp/SettingsViewController.swift index c1d050c19..66137bb88 100644 --- a/MoppApp/MoppApp/SettingsViewController.swift +++ b/MoppApp/MoppApp/SettingsViewController.swift @@ -99,6 +99,7 @@ class SettingsViewController: MoppViewController { CertUtil.removeCertificate(folder: SettingsTSACertCell.tsaFileFolder, fileName: DefaultsHelper.tsaCertFileName ?? "") CertUtil.removeCertificate(folder: SivaCertViewController.sivaFileFolder, fileName: DefaultsHelper.sivaCertFileName ?? "") + } func resetTSA() { CertUtil.removeCertificate(folder: SettingsTSACertCell.tsaFileFolder, fileName: DefaultsHelper.tsaCertFileName ?? "") @@ -106,7 +107,7 @@ class SettingsViewController: MoppViewController { } func resetSiva() { - CertUtil.removeCertificate(folder: SettingsSivaCertCell.sivaFileFolder, fileName: DefaultsHelper.sivaCertFileName ?? "") + CertUtil.removeCertificate(folder: SivaCertViewController.sivaFileFolder, fileName: DefaultsHelper.sivaCertFileName ?? "") DefaultsHelper.sivaCertFileName = "" DefaultsHelper.sivaAccessState = .defaultAccess DefaultsHelper.sivaUrl = Configuration.getConfiguration().SIVAURL @@ -118,7 +119,6 @@ class SettingsViewController: MoppViewController { DefaultsHelper.proxyPort = 80 DefaultsHelper.proxyUsername = "" KeychainUtil.remove(key: proxyPasswordKey) - DefaultsHelper.isProxyForSSLEnabled = true } deinit { diff --git a/MoppApp/MoppApp/Signing/Siva/SivaCategoryCell.swift b/MoppApp/MoppApp/Signing/Siva/SivaCategoryCell.swift index b10931659..51665f0e0 100644 --- a/MoppApp/MoppApp/Signing/Siva/SivaCategoryCell.swift +++ b/MoppApp/MoppApp/Signing/Siva/SivaCategoryCell.swift @@ -25,6 +25,7 @@ import UIKit class SivaCategoryCell: UITableViewCell { + @IBOutlet weak var accessToSivaView: UIView! @IBOutlet weak var accessToSivaButton: ScaledLabel! @objc func openAccessToSivaSettings() { @@ -63,6 +64,8 @@ class SivaCategoryCell: UITableViewCell { self.accessToSivaButton.textColor = .systemBlue self.accessToSivaButton.isUserInteractionEnabled = true self.accessToSivaButton.resetLabelProperties() + + self.accessToSivaView.accessibilityUserInputLabels = [L(.voiceControlSivaCategory)] } private func openAccessToSivaView() { diff --git a/MoppApp/MoppApp/Signing/SivaCertViewController.swift b/MoppApp/MoppApp/Signing/SivaCertViewController.swift index 7c550cdbf..1e9976da5 100644 --- a/MoppApp/MoppApp/Signing/SivaCertViewController.swift +++ b/MoppApp/MoppApp/Signing/SivaCertViewController.swift @@ -57,7 +57,10 @@ class SivaCertViewController: MoppViewController { @IBOutlet weak var issuedToLabel: ScaledLabel! @IBOutlet weak var validUntilLabel: ScaledLabel! + @IBOutlet weak var addCertificateView: UIView! @IBOutlet weak var addCertificateButton: ScaledLabel! + + @IBOutlet weak var showCertificateView: UIView! @IBOutlet weak var showCertificateButton: ScaledLabel! @IBAction func dismissView(_ sender: ScaledButton) { @@ -257,6 +260,8 @@ class SivaCertViewController: MoppViewController { self.addCertificateButton.isUserInteractionEnabled = true self.addCertificateButton.resetLabelProperties() + self.addCertificateView.accessibilityUserInputLabels = [L(.settingsTimestampCertAddCertificateButton)] + self.showCertificateButton.text = L(.settingsTimestampCertShowCertificateButton) self.showCertificateButton.accessibilityLabel = self.showCertificateButton.text?.lowercased() self.showCertificateButton.font = .moppMedium @@ -264,6 +269,8 @@ class SivaCertViewController: MoppViewController { self.showCertificateButton.isUserInteractionEnabled = true self.showCertificateButton.resetLabelProperties() + self.showCertificateView.accessibilityUserInputLabels = [L(.settingsTimestampCertShowCertificateButton)] + if self.addCertificateButton.gestureRecognizers == nil || self.addCertificateButton.gestureRecognizers?.isEmpty == true { let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.addCertificate)) self.addCertificateButton.addGestureRecognizer(tapGesture) diff --git a/MoppApp/MoppApp/en.lproj/Localizable.strings b/MoppApp/MoppApp/en.lproj/Localizable.strings index 408300a8a..890f00337 100755 --- a/MoppApp/MoppApp/en.lproj/Localizable.strings +++ b/MoppApp/MoppApp/en.lproj/Localizable.strings @@ -391,7 +391,6 @@ "settings-proxy-port" = "Port"; "settings-proxy-username" = "Username"; "settings-proxy-password" = "Password"; -"settings-proxy-allow-ssl" = "Enable proxy for SSL connections"; "settings-reset-button" = "USE DEFAULT SETTINGS"; "diagnostics-title" = "Diagnostics"; "diagnostics-activate-one-time-logging" = "Enable one-time log generation"; @@ -539,6 +538,7 @@ "voice-control-role-country" = "Country"; "voice-control-role-zip" = "Zip"; "voice-control-role-and-address" = "Role and address"; +"voice-control-siva-category" = "Access to Siva"; "voice-control-siva-service" = "Edit Validation service"; "voice-control-siva-default-access" = "Default validation access"; "voice-control-siva-manual-access" = "Manual validation access"; diff --git a/MoppApp/MoppApp/et.lproj/Localizable.strings b/MoppApp/MoppApp/et.lproj/Localizable.strings index 01f3fad28..cd24a064d 100755 --- a/MoppApp/MoppApp/et.lproj/Localizable.strings +++ b/MoppApp/MoppApp/et.lproj/Localizable.strings @@ -392,7 +392,6 @@ "settings-proxy-port" = "Port"; "settings-proxy-username" = "Kasutajanimi"; "settings-proxy-password" = "Parool"; -"settings-proxy-allow-ssl" = "Luba proksi kasutamine SSL-ühenduste jaoks"; "settings-reset-button" = "TAASTA ALGSEADED"; "diagnostics-title" = "Diagnostika"; "diagnostics-activate-one-time-logging" = "Aktiveeri ühekordne logifaili genereerimine"; @@ -539,6 +538,7 @@ "voice-control-role-country" = "Country"; "voice-control-role-zip" = "Zip"; "voice-control-role-and-address" = "Role and address"; +"voice-control-siva-category" = "Access to Siva"; "voice-control-siva-service" = "Edit Validation service"; "voice-control-siva-default-access" = "Default validation access"; "voice-control-siva-manual-access" = "Manual validation access"; diff --git a/MoppApp/MoppApp/ru.lproj/Localizable.strings b/MoppApp/MoppApp/ru.lproj/Localizable.strings index 9eec98d14..2082febaf 100644 --- a/MoppApp/MoppApp/ru.lproj/Localizable.strings +++ b/MoppApp/MoppApp/ru.lproj/Localizable.strings @@ -389,7 +389,6 @@ "settings-proxy-port" = "Порт"; "settings-proxy-username" = "Имя пользователя"; "settings-proxy-password" = "Пароль"; -"settings-proxy-allow-ssl" = "Включить прокси-сервер для подключения SSL"; "settings-siva-default-access-title" = "Использовать доступ, назначенный по умолчанию"; "settings-siva-default-manual-access-title" = "Использовать доступ, назначенный вручную"; "settings-siva-default-certificate-title" = "Сертификат услуги валидации SiVa SSL"; @@ -540,6 +539,7 @@ "voice-control-role-country" = "Country"; "voice-control-role-zip" = "Zip"; "voice-control-role-and-address" = "Role and address"; +"voice-control-siva-category" = "Access to Siva"; "voice-control-siva-service" = "Edit Validation service"; "voice-control-siva-default-access" = "Default validation access"; "voice-control-siva-manual-access" = "Manual validation access"; diff --git a/MoppLib/MoppLib/MoppLibDigidocManager.mm b/MoppLib/MoppLib/MoppLibDigidocManager.mm index 4362f5aa3..a81eebd3d 100644 --- a/MoppLib/MoppLib/MoppLibDigidocManager.mm +++ b/MoppLib/MoppLib/MoppLibDigidocManager.mm @@ -159,10 +159,6 @@ virtual std::string proxyPass() const override { return std::string([proxyConfiguration.PASSWORD UTF8String]); } - - virtual bool proxyTunnelSSL() const override { - return proxyConfiguration.ISSSLENABLED; - } std::vector stringsToX509Certs(NSArray *certBundle) const { __block std::vector x509Certs; diff --git a/MoppLib/MoppLib/PublicInterface/MoppLibProxyConfiguration.h b/MoppLib/MoppLib/PublicInterface/MoppLibProxyConfiguration.h index 327ee4e8b..27d6290dc 100644 --- a/MoppLib/MoppLib/PublicInterface/MoppLibProxyConfiguration.h +++ b/MoppLib/MoppLib/PublicInterface/MoppLibProxyConfiguration.h @@ -29,8 +29,7 @@ @property (nonatomic, strong) NSNumber *PORT; @property (nonatomic, strong) NSString *USERNAME; @property (nonatomic, strong) NSString *PASSWORD; -@property (nonatomic, assign) BOOL *ISSSLENABLED; -- (id) initWithConfiguration:(NSString *)HOST PORT:(NSNumber *)PORT USERNAME:(NSString *)USERNAME PASSWORD:(NSString *)PASSWORD ISSSLENABLED:(BOOL)ISSSLENABLED; +- (id) initWithConfiguration:(NSString *)HOST PORT:(NSNumber *)PORT USERNAME:(NSString *)USERNAME PASSWORD:(NSString *)PASSWORD; @end diff --git a/MoppLib/MoppLib/PublicInterface/MoppLibProxyConfiguration.m b/MoppLib/MoppLib/PublicInterface/MoppLibProxyConfiguration.m index 511585862..e33cce08a 100644 --- a/MoppLib/MoppLib/PublicInterface/MoppLibProxyConfiguration.m +++ b/MoppLib/MoppLib/PublicInterface/MoppLibProxyConfiguration.m @@ -25,7 +25,7 @@ @implementation MoppLibProxyConfiguration -- (id) initWithConfiguration:(NSString *)HOST PORT:(NSNumber *)PORT USERNAME:(NSString *)USERNAME PASSWORD:(NSString *)PASSWORD { +- (id)initWithConfiguration:(NSString *)HOST PORT:(NSNumber *)PORT USERNAME:(NSString *)USERNAME PASSWORD:(NSString *)PASSWORD { self = [super init]; if (self) { self.HOST = HOST; diff --git a/SkSigningLib/SkSigningLib/Utilities/Proxy/Proxy.swift b/SkSigningLib/SkSigningLib/Utilities/Proxy/Proxy.swift index 85c7ecca2..ae896d804 100644 --- a/SkSigningLib/SkSigningLib/Utilities/Proxy/Proxy.swift +++ b/SkSigningLib/SkSigningLib/Utilities/Proxy/Proxy.swift @@ -28,13 +28,11 @@ public struct Proxy { public var port: Int public var username: String public var password: String - public var isSSLEnabled: Bool - public init(host: String, port: Int, username: String, password: String, isSSLEnabled: Bool) { + public init(host: String, port: Int, username: String, password: String) { self.host = host self.port = port self.username = username self.password = password - self.isSSLEnabled = isSSLEnabled } } diff --git a/SkSigningLib/SkSigningLib/Utilities/Proxy/ProxyUtil.swift b/SkSigningLib/SkSigningLib/Utilities/Proxy/ProxyUtil.swift index 25f5089ac..c214bb1f5 100644 --- a/SkSigningLib/SkSigningLib/Utilities/Proxy/ProxyUtil.swift +++ b/SkSigningLib/SkSigningLib/Utilities/Proxy/ProxyUtil.swift @@ -31,10 +31,10 @@ public enum ProxySetting: String, Codable { public class ProxyUtil { - public static func createProxyConfiguration(proxySetting: ProxySetting, proxyHost: String?, proxyPort: Int?, proxyUsername: String?, proxyPassword: String?, isProxySSLEnabled: Bool) -> [AnyHashable: Any]? { + public static func createProxyConfiguration(proxySetting: ProxySetting, proxyHost: String?, proxyPort: Int?, proxyUsername: String?, proxyPassword: String?) -> [AnyHashable: Any]? { // Use manual proxy settings - if proxySetting == .manualProxy, isProxySSLEnabled, let host = proxyHost, let port = proxyPort, !host.isEmpty, port > 0 { + if proxySetting == .manualProxy, let host = proxyHost, let port = proxyPort, !host.isEmpty, port > 0 { let proxyConfiguration: [AnyHashable : Any] = [ String(kCFNetworkProxiesHTTPEnable): 1, String(kCFNetworkProxiesHTTPProxy): host, @@ -50,7 +50,7 @@ public class ProxyUtil { return proxyConfiguration } // Check if system proxy settings exist. iOS automatically handles proxy configuration with system settings - else if proxySetting == .systemProxy, isProxySSLEnabled, let proxySettingsUnmanaged = CFNetworkCopySystemProxySettings() { + else if proxySetting == .systemProxy, let proxySettingsUnmanaged = CFNetworkCopySystemProxySettings() { let proxySettings = proxySettingsUnmanaged.takeRetainedValue() as? [AnyHashable : Any] if let systemHost = proxySettings?[kCFNetworkProxiesHTTPProxy] as? String, let systemPort = proxySettings?[kCFNetworkProxiesHTTPPort] as? Int, !systemHost.isEmpty && systemPort > 0 { return nil @@ -85,7 +85,7 @@ public class ProxyUtil { public static func configureURLSessionWithProxy(urlSessionConfiguration: inout URLSessionConfiguration, manualProxyConf: Proxy) { let proxyConfiguration = ProxyUtil.createProxyConfiguration( proxySetting: .manualProxy, - proxyHost: manualProxyConf.host, proxyPort: manualProxyConf.port, proxyUsername: manualProxyConf.username, proxyPassword: manualProxyConf.password, isProxySSLEnabled: manualProxyConf.isSSLEnabled) + proxyHost: manualProxyConf.host, proxyPort: manualProxyConf.port, proxyUsername: manualProxyConf.username, proxyPassword: manualProxyConf.password) if let proxyConf = proxyConfiguration { urlSessionConfiguration.connectionProxyDictionary = proxyConf