Simplify commit of network settings

This commit is contained in:
Davide De Rosa 2019-07-03 17:58:14 +02:00
parent 60b60646d4
commit 1bead621fc

View File

@ -207,22 +207,18 @@ class NetworkSettingsViewController: UITableViewController {
}
private func commitChanges() {
let settings = profile?.manualNetworkSettings ?? ProfileNetworkSettings()
profile?.networkChoices = networkChoices
if networkChoices.gateway == .manual {
let settings = profile?.manualNetworkSettings ?? ProfileNetworkSettings()
settings.copyGateway(from: networkSettings)
profile?.manualNetworkSettings = settings
}
if networkChoices.dns == .manual {
let settings = profile?.manualNetworkSettings ?? ProfileNetworkSettings()
settings.copyDNS(from: networkSettings)
profile?.manualNetworkSettings = settings
}
if networkChoices.proxy == .manual {
let settings = profile?.manualNetworkSettings ?? ProfileNetworkSettings()
settings.copyProxy(from: networkSettings)
profile?.manualNetworkSettings = settings
}
profile?.manualNetworkSettings = settings
}
}