Only show pushed server configuration
This commit is contained in:
parent
a82454f5cf
commit
0657ae3b92
|
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Fixed
|
||||
|
||||
- Only show pushed server configuration.
|
||||
|
||||
## 1.9.1 (2019-11-10)
|
||||
|
||||
### Changed
|
||||
|
|
|
@ -46,20 +46,26 @@ class ConfigurationViewController: UIViewController, StrongTableHost {
|
|||
return originalConfigurationURL != nil
|
||||
}
|
||||
|
||||
var isServerPushed = false
|
||||
|
||||
weak var delegate: ConfigurationModificationDelegate?
|
||||
|
||||
// MARK: StrongTableHost
|
||||
|
||||
lazy var model: StrongTableModel<SectionType, RowType> = {
|
||||
let model: StrongTableModel<SectionType, RowType> = StrongTableModel()
|
||||
|
||||
func reloadModel() {
|
||||
model.clear()
|
||||
|
||||
// sections
|
||||
model.add(.communication)
|
||||
model.add(.compression)
|
||||
if isEditable {
|
||||
model.add(.reset)
|
||||
}
|
||||
if !isServerPushed {
|
||||
model.add(.tls)
|
||||
}
|
||||
model.add(.other)
|
||||
|
||||
// headers
|
||||
|
@ -74,18 +80,47 @@ class ConfigurationViewController: UIViewController, StrongTableHost {
|
|||
}
|
||||
|
||||
// rows
|
||||
if isServerPushed {
|
||||
var rows: [RowType]
|
||||
|
||||
rows = []
|
||||
if let _ = configuration.cipher {
|
||||
rows.append(.cipher)
|
||||
}
|
||||
if let _ = configuration.digest {
|
||||
rows.append(.digest)
|
||||
}
|
||||
model.set(rows, forSection: .communication)
|
||||
|
||||
rows = []
|
||||
if let _ = configuration.compressionFraming {
|
||||
rows.append(.compressionFraming)
|
||||
}
|
||||
if let _ = configuration.compressionAlgorithm {
|
||||
rows.append(.compressionAlgorithm)
|
||||
}
|
||||
model.set(rows, forSection: .compression)
|
||||
|
||||
rows = []
|
||||
if let _ = configuration.keepAliveInterval {
|
||||
rows.append(.keepAlive)
|
||||
}
|
||||
if let _ = configuration.renegotiatesAfter {
|
||||
rows.append(.renegSeconds)
|
||||
}
|
||||
if let _ = configuration.randomizeEndpoint {
|
||||
rows.append(.randomEndpoint)
|
||||
}
|
||||
model.set(rows, forSection: .other)
|
||||
} else {
|
||||
model.set([.cipher, .digest], forSection: .communication)
|
||||
model.set([.compressionFraming, .compressionAlgorithm], forSection: .compression)
|
||||
model.set([.keepAlive, .renegSeconds, .randomEndpoint], forSection: .other)
|
||||
}
|
||||
if isEditable {
|
||||
model.set([.resetOriginal], forSection: .reset)
|
||||
}
|
||||
model.set([.client, .tlsWrapping, .eku], forSection: .tls)
|
||||
model.set([.compressionFraming, .compressionAlgorithm], forSection: .compression)
|
||||
model.set([.keepAlive, .renegSeconds, .randomEndpoint], forSection: .other)
|
||||
|
||||
return model
|
||||
}()
|
||||
|
||||
func reloadModel() {
|
||||
}
|
||||
|
||||
// MARK: UIViewController
|
||||
|
@ -96,6 +131,7 @@ class ConfigurationViewController: UIViewController, StrongTableHost {
|
|||
guard let _ = initialConfiguration else {
|
||||
fatalError("Initial configuration not set")
|
||||
}
|
||||
reloadModel()
|
||||
|
||||
guard isEditable else {
|
||||
tableView.allowsSelection = false
|
||||
|
|
|
@ -522,6 +522,7 @@ class ServiceViewController: UIViewController, StrongTableHost {
|
|||
let vc = StoryboardScene.Main.configurationIdentifier.instantiate()
|
||||
vc.title = caption
|
||||
vc.initialConfiguration = $0
|
||||
vc.isServerPushed = true
|
||||
self?.navigationController?.pushViewController(vc, animated: true)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue