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 isTrusted = false
let rowIndex = rowIndexForWifi(at: index) let rowIndex = rowIndexForWifi(at: index)
let completionHandler: () -> Void = { trustedWifis[wifiToAdd] = isTrusted
self.trustedWifis[wifiToAdd] = isTrusted
if !isDuplicate { if !isDuplicate {
self.sortedWifis.insert(wifiToAdd, at: index) sortedWifis.insert(wifiToAdd, at: index)
#if os(iOS) #if os(iOS)
self.rows.insert(.trustedWiFi, at: rowIndex) rows.insert(.trustedWiFi, at: rowIndex)
#endif #endif
self.delegate?.trustedNetworks(self, shouldInsertWifiAt: rowIndex) delegate?.trustedNetworks(self, shouldInsertWifiAt: rowIndex)
} else { } else {
self.delegate?.trustedNetworks(self, shouldReloadWifiAt: rowIndex, isTrusted: isTrusted) delegate?.trustedNetworks(self, shouldReloadWifiAt: rowIndex, isTrusted: isTrusted)
} }
self.delegate?.trustedNetworksShouldReinstall(self) delegate?.trustedNetworksShouldReinstall(self)
}
guard !mightDisconnect() else {
delegate?.trustedNetworksShouldConfirmDisconnection(self, triggeredAt: rowIndex, completionHandler: completionHandler)
return
}
completionHandler()
} }
func removeWifi(at rowIndex: Int) { func removeWifi(at rowIndex: Int) {