diff --git a/DuckDuckGo/MaliciousSiteProtection/Settings/MaliciousSiteProtectionSettingsViewModel.swift b/DuckDuckGo/MaliciousSiteProtection/Settings/MaliciousSiteProtectionSettingsViewModel.swift index c4e13afdd3..e16110ee6a 100644 --- a/DuckDuckGo/MaliciousSiteProtection/Settings/MaliciousSiteProtectionSettingsViewModel.swift +++ b/DuckDuckGo/MaliciousSiteProtection/Settings/MaliciousSiteProtectionSettingsViewModel.swift @@ -32,8 +32,7 @@ final class MaliciousSiteProtectionSettingsViewModel: ObservableObject { self.manager.isEnabled }, set: { - self.manager.isEnabled = $0 - self.isMaliciousSiteProtectionEnabled = $0 + self.updateMaliciousSiteProtection(enabled: $0) } ) } @@ -57,4 +56,10 @@ final class MaliciousSiteProtectionSettingsViewModel: ObservableObject { func learnMoreAction() { urlOpener.open(URL.maliciousSiteProtectionLearnMore) } + + private func updateMaliciousSiteProtection(enabled isEnabled: Bool) { + manager.isEnabled = isEnabled + isMaliciousSiteProtectionEnabled = isEnabled + } + }