Drop redundant disconnection alert on Wi-Fi add

Doesn't trust by default, so it won't disconnect.

See 474105d
This commit is contained in:
Davide De Rosa 2018-10-30 00:25:45 +01:00
parent e566b2483e
commit 0706d552be
1 changed files with 11 additions and 18 deletions

View File

@ -131,26 +131,19 @@ class TrustedNetworksModel {
let isTrusted = false
let rowIndex = rowIndexForWifi(at: index)
let completionHandler: () -> Void = {
self.trustedWifis[wifiToAdd] = isTrusted
trustedWifis[wifiToAdd] = isTrusted
if !isDuplicate {
self.sortedWifis.insert(wifiToAdd, at: index)
#if os(iOS)
self.rows.insert(.trustedWiFi, at: rowIndex)
#endif
self.delegate?.trustedNetworks(self, shouldInsertWifiAt: rowIndex)
} else {
self.delegate?.trustedNetworks(self, shouldReloadWifiAt: rowIndex, isTrusted: isTrusted)
}
if !isDuplicate {
sortedWifis.insert(wifiToAdd, at: index)
#if os(iOS)
rows.insert(.trustedWiFi, at: rowIndex)
#endif
delegate?.trustedNetworks(self, shouldInsertWifiAt: rowIndex)
} else {
delegate?.trustedNetworks(self, shouldReloadWifiAt: rowIndex, isTrusted: isTrusted)
}
self.delegate?.trustedNetworksShouldReinstall(self)
}
guard !mightDisconnect() else {
delegate?.trustedNetworksShouldConfirmDisconnection(self, triggeredAt: rowIndex, completionHandler: completionHandler)
return
}
completionHandler()
delegate?.trustedNetworksShouldReinstall(self)
}
func removeWifi(at rowIndex: Int) {