Migrate to Configuration optionals

- cipher
- digest
- compressionFraming
This commit is contained in:
Davide De Rosa 2019-04-04 13:23:20 +02:00
parent d53e874cac
commit fe669bb3e0
3 changed files with 9 additions and 9 deletions

View File

@ -241,12 +241,12 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
switch row {
case .cipher:
cell.leftText = L10n.Configuration.Cells.Cipher.caption
cell.rightText = configuration.cipher.description
cell.rightText = configuration.fallbackCipher.description
case .digest:
cell.leftText = L10n.Configuration.Cells.Digest.caption
if !configuration.cipher.embedsDigest {
cell.rightText = configuration.digest.description
if !configuration.fallbackCipher.embedsDigest {
cell.rightText = configuration.fallbackDigest.description
} else {
cell.rightText = L10n.Configuration.Cells.Digest.Value.embedded
cell.accessoryType = .none
@ -287,7 +287,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
case .compressionFraming:
cell.leftText = L10n.Configuration.Cells.CompressionFraming.caption
cell.rightText = configuration.compressionFraming.cellDescription
cell.rightText = configuration.fallbackCompressionFraming.cellDescription
cell.accessoryType = .none
cell.isTappable = false
@ -360,7 +360,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
navigationController?.pushViewController(vc, animated: true)
case .digest:
guard !configuration.cipher.embedsDigest else {
guard !configuration.fallbackCipher.embedsDigest else {
return
}

View File

@ -701,10 +701,10 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Service.Cells.Host.Parameters.caption
let V = L10n.Service.Cells.Host.Parameters.Value.self
if !parameters.sessionConfiguration.cipher.embedsDigest {
cell.rightText = V.cipherDigest(parameters.sessionConfiguration.cipher.genericName, parameters.sessionConfiguration.digest.genericName)
if !parameters.sessionConfiguration.fallbackCipher.embedsDigest {
cell.rightText = V.cipherDigest(parameters.sessionConfiguration.fallbackCipher.genericName, parameters.sessionConfiguration.fallbackDigest.genericName)
} else {
cell.rightText = V.cipher(parameters.sessionConfiguration.cipher.genericName)
cell.rightText = V.cipher(parameters.sessionConfiguration.fallbackCipher.genericName)
}
return cell

View File

@ -36,7 +36,7 @@ public extension SessionProxy.ConfigurationBuilder {
func canCommunicate(with other: SessionProxy.Configuration) -> Bool {
return
(cipher == other.cipher) &&
((digest == other.digest) || cipher.embedsDigest) &&
((digest == other.digest) || fallbackCipher.embedsDigest) &&
(compressionFraming == other.compressionFraming)
}
}