From 81cac8beba99795e6942266266365f683fd4545e Mon Sep 17 00:00:00 2001 From: Tomas Strba Date: Wed, 20 Sep 2023 10:29:58 +0200 Subject: [PATCH] Code deduplication --- DuckDuckGo/Common/Extensions/URLExtension.swift | 4 ++++ .../Bitwarden/View/ConnectBitwardenViewModel.swift | 2 +- DuckDuckGo/Preferences/Model/AutofillPreferencesModel.swift | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DuckDuckGo/Common/Extensions/URLExtension.swift b/DuckDuckGo/Common/Extensions/URLExtension.swift index f11719f26a..da4a435127 100644 --- a/DuckDuckGo/Common/Extensions/URLExtension.swift +++ b/DuckDuckGo/Common/Extensions/URLExtension.swift @@ -430,4 +430,8 @@ extension URL { } } + + // MARK: - System Settings + + static var fullDiskAccess = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles") } diff --git a/DuckDuckGo/PasswordManager/Bitwarden/View/ConnectBitwardenViewModel.swift b/DuckDuckGo/PasswordManager/Bitwarden/View/ConnectBitwardenViewModel.swift index d334bb234f..396738e78d 100644 --- a/DuckDuckGo/PasswordManager/Bitwarden/View/ConnectBitwardenViewModel.swift +++ b/DuckDuckGo/PasswordManager/Bitwarden/View/ConnectBitwardenViewModel.swift @@ -142,7 +142,7 @@ final class ConnectBitwardenViewModel: ObservableObject { } else if viewState == .disclaimer { viewState = .lookingForBitwarden } else if viewState == .accessToContainersNotApproved { - guard let link = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles") else { + guard let link = URL.fullDiskAccess else { assertionFailure("Can't initialize link to Settings") return } diff --git a/DuckDuckGo/Preferences/Model/AutofillPreferencesModel.swift b/DuckDuckGo/Preferences/Model/AutofillPreferencesModel.swift index ae5cdf5d1c..e77c4434b8 100644 --- a/DuckDuckGo/Preferences/Model/AutofillPreferencesModel.swift +++ b/DuckDuckGo/Preferences/Model/AutofillPreferencesModel.swift @@ -178,7 +178,7 @@ final class AutofillPreferencesModel: ObservableObject { } func openSettings() { - guard let link = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles") else { + guard let link = URL.fullDiskAccess else { assertionFailure("Can't initialize link to Settings") return }