summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJon Petersson <jon.petersson@mullvad.net>2025-10-10 09:57:49 +0200
committerJon Petersson <jon.petersson@mullvad.net>2025-10-14 09:58:35 +0200
commitef38d775c90944cbdbe7e0a79676fe6af0069b29 (patch)
tree738e58026f7ed528952f86315d72af2dc2627ceb
parentd62196f87e43f2970a90825045800924bb28f2a5 (diff)
downloadmullvadvpn-ef38d775c90944cbdbe7e0a79676fe6af0069b29.tar.xz
mullvadvpn-ef38d775c90944cbdbe7e0a79676fe6af0069b29.zip
Fix broken direct only warning when toggling
-rw-r--r--ios/MullvadVPN/Coordinators/Settings/DAITA/DAITATunnelSettingsViewModel.swift19
1 files changed, 8 insertions, 11 deletions
diff --git a/ios/MullvadVPN/Coordinators/Settings/DAITA/DAITATunnelSettingsViewModel.swift b/ios/MullvadVPN/Coordinators/Settings/DAITA/DAITATunnelSettingsViewModel.swift
index 072ea50e96..8b61c9c279 100644
--- a/ios/MullvadVPN/Coordinators/Settings/DAITA/DAITATunnelSettingsViewModel.swift
+++ b/ios/MullvadVPN/Coordinators/Settings/DAITA/DAITATunnelSettingsViewModel.swift
@@ -92,19 +92,16 @@ extension DAITATunnelSettingsViewModel {
var compatibilityError: DAITASettingsCompatibilityError?
- do {
- _ = try tunnelManager.selectRelays(tunnelSettings: tunnelSettings)
- } catch let error as NoRelaysSatisfyingConstraintsError where error.reason == .noDaitaRelaysFound {
- // Return error if no relays could be selected due to DAITA constraints.
- compatibilityError = tunnelSettings.tunnelMultihopState.isEnabled ? .multihop : .singlehop
- } catch _ as NoRelaysSatisfyingConstraintsError {
- // Even if the constraints error is not DAITA specific, if both DAITA and Direct only are enabled,
- // we should return a DAITA related error since the current settings would have resulted in the
- // relay selector not being able to select a DAITA relay anyway.
- if settings.isDirectOnly {
+ if settings.isDirectOnly {
+ let relays = try? tunnelManager.selectRelays(tunnelSettings: tunnelSettings)
+
+ // Even if the reason for not finding any relays is not DAITA specific, if both DAITA and Direct
+ // only are enabled, we should return a DAITA related error since the current settings would have
+ // resulted in the relay selector not being able to select a DAITA relay anyway.
+ if relays == nil {
compatibilityError = tunnelSettings.tunnelMultihopState.isEnabled ? .multihop : .singlehop
}
- } catch {}
+ }
return compatibilityError
}