Only make host editable if original cfg available
This commit is contained in:
parent
205bef822e
commit
52cf733948
|
@ -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/),
|
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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Host parameters are read-only if there isn't an original configuration to revert to.
|
||||||
|
|
||||||
## 1.0 beta 1084 (2018-10-24)
|
## 1.0 beta 1084 (2018-10-24)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -38,21 +38,22 @@ class ConfigurationViewController: UIViewController, TableModelHost {
|
||||||
|
|
||||||
private lazy var configuration: SessionProxy.ConfigurationBuilder = initialConfiguration.builder()
|
private lazy var configuration: SessionProxy.ConfigurationBuilder = initialConfiguration.builder()
|
||||||
|
|
||||||
var isEditable = false
|
|
||||||
|
|
||||||
var originalConfigurationURL: URL?
|
var originalConfigurationURL: URL?
|
||||||
|
|
||||||
|
private var isEditable: Bool {
|
||||||
|
return originalConfigurationURL != nil
|
||||||
|
}
|
||||||
|
|
||||||
weak var delegate: ConfigurationModificationDelegate?
|
weak var delegate: ConfigurationModificationDelegate?
|
||||||
|
|
||||||
// MARK: TableModelHost
|
// MARK: TableModelHost
|
||||||
|
|
||||||
lazy var model: TableModel<SectionType, RowType> = {
|
lazy var model: TableModel<SectionType, RowType> = {
|
||||||
let model: TableModel<SectionType, RowType> = TableModel()
|
let model: TableModel<SectionType, RowType> = TableModel()
|
||||||
let hasConfigurationURL = isEditable && (originalConfigurationURL != nil)
|
|
||||||
|
|
||||||
// sections
|
// sections
|
||||||
model.add(.communication)
|
model.add(.communication)
|
||||||
if hasConfigurationURL {
|
if isEditable {
|
||||||
model.add(.reset)
|
model.add(.reset)
|
||||||
}
|
}
|
||||||
model.add(.tls)
|
model.add(.tls)
|
||||||
|
@ -64,15 +65,13 @@ class ConfigurationViewController: UIViewController, TableModelHost {
|
||||||
model.setHeader(L10n.Configuration.Sections.Other.header, for: .other)
|
model.setHeader(L10n.Configuration.Sections.Other.header, for: .other)
|
||||||
|
|
||||||
// footers
|
// footers
|
||||||
if hasConfigurationURL {
|
if isEditable {
|
||||||
model.setFooter(L10n.Configuration.Sections.Reset.footer, for: .reset)
|
model.setFooter(L10n.Configuration.Sections.Reset.footer, for: .reset)
|
||||||
} else if isEditable {
|
|
||||||
model.setFooter(L10n.Configuration.Sections.Communication.Footer.editable, for: .communication)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// rows
|
// rows
|
||||||
model.set([.cipher, .digest, .compressionFrame], in: .communication)
|
model.set([.cipher, .digest, .compressionFrame], in: .communication)
|
||||||
if hasConfigurationURL {
|
if isEditable {
|
||||||
model.set([.resetOriginal], in: .reset)
|
model.set([.resetOriginal], in: .reset)
|
||||||
}
|
}
|
||||||
model.set([.client, .tlsWrapping], in: .tls)
|
model.set([.client, .tlsWrapping], in: .tls)
|
||||||
|
|
|
@ -154,7 +154,6 @@ class ServiceViewController: UIViewController, TableModelHost {
|
||||||
let vc = destination as? ConfigurationViewController
|
let vc = destination as? ConfigurationViewController
|
||||||
vc?.title = L10n.Service.Cells.Host.Parameters.caption
|
vc?.title = L10n.Service.Cells.Host.Parameters.caption
|
||||||
vc?.initialConfiguration = uncheckedHostProfile.parameters.sessionConfiguration
|
vc?.initialConfiguration = uncheckedHostProfile.parameters.sessionConfiguration
|
||||||
vc?.isEditable = true
|
|
||||||
vc?.originalConfigurationURL = ProfileConfigurationFactory.shared.configurationURL(for: uncheckedHostProfile)
|
vc?.originalConfigurationURL = ProfileConfigurationFactory.shared.configurationURL(for: uncheckedHostProfile)
|
||||||
vc?.delegate = self
|
vc?.delegate = self
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,6 @@
|
||||||
//"provider.preset.sections.main.footer" = "Tap info button to disclose technical details.";
|
//"provider.preset.sections.main.footer" = "Tap info button to disclose technical details.";
|
||||||
|
|
||||||
"configuration.sections.communication.header" = "Communication";
|
"configuration.sections.communication.header" = "Communication";
|
||||||
"configuration.sections.communication.footer.editable" = "Make sure to match server communication parameters, otherwise you will end up with broken connectivity.";
|
|
||||||
"configuration.sections.reset.footer" = "If you ended up with broken connectivity after changing the communication parameters, tap to revert to the original configuration.";
|
"configuration.sections.reset.footer" = "If you ended up with broken connectivity after changing the communication parameters, tap to revert to the original configuration.";
|
||||||
"configuration.sections.tls.header" = "TLS";
|
"configuration.sections.tls.header" = "TLS";
|
||||||
"configuration.sections.other.header" = "Other";
|
"configuration.sections.other.header" = "Other";
|
||||||
|
|
|
@ -205,11 +205,6 @@ internal enum L10n {
|
||||||
internal enum Communication {
|
internal enum Communication {
|
||||||
/// Communication
|
/// Communication
|
||||||
internal static let header = L10n.tr("Localizable", "configuration.sections.communication.header")
|
internal static let header = L10n.tr("Localizable", "configuration.sections.communication.header")
|
||||||
|
|
||||||
internal enum Footer {
|
|
||||||
/// Make sure to match server communication parameters, otherwise you will end up with broken connectivity.
|
|
||||||
internal static let editable = L10n.tr("Localizable", "configuration.sections.communication.footer.editable")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal enum Other {
|
internal enum Other {
|
||||||
|
|
Loading…
Reference in New Issue