From 1bead621fc3be8e7d74b9d74d80a12966d86f1b5 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Wed, 3 Jul 2019 17:58:14 +0200 Subject: [PATCH] Simplify commit of network settings --- .../Scenes/NetworkSettingsViewController.swift | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Passepartout-iOS/Scenes/NetworkSettingsViewController.swift b/Passepartout-iOS/Scenes/NetworkSettingsViewController.swift index a147ea18..ff649981 100644 --- a/Passepartout-iOS/Scenes/NetworkSettingsViewController.swift +++ b/Passepartout-iOS/Scenes/NetworkSettingsViewController.swift @@ -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 } }