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

View File

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

View File

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