From c6d40b44bfd3b9a0e8bc25172f0230aa4711e230 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Wed, 15 Nov 2023 19:21:17 -0800 Subject: [PATCH] Fix release build compilation. --- DuckDuckGo/AppDelegate+Waitlists.swift | 8 ++++++++ DuckDuckGo/AppDelegate.swift | 3 +++ DuckDuckGo/NetworkProtectionAccessController.swift | 4 ++++ DuckDuckGo/SettingsViewController.swift | 3 +++ DuckDuckGo/VPNWaitlist.swift | 4 ++++ DuckDuckGo/VPNWaitlistDebugViewController.swift | 4 ++++ DuckDuckGo/VPNWaitlistView.swift | 4 ++++ DuckDuckGo/VPNWaitlistViewController.swift | 4 ++++ 8 files changed, 34 insertions(+) diff --git a/DuckDuckGo/AppDelegate+Waitlists.swift b/DuckDuckGo/AppDelegate+Waitlists.swift index 4e760e6cbc..83f5a84a24 100644 --- a/DuckDuckGo/AppDelegate+Waitlists.swift +++ b/DuckDuckGo/AppDelegate+Waitlists.swift @@ -25,8 +25,12 @@ extension AppDelegate { func checkWaitlists() { checkWindowsWaitlist() + +#if NETWORK_PROTECTION checkNetworkProtectionWaitlist() +#endif checkWaitlistBackgroundTasks() + } private func checkWindowsWaitlist() { @@ -36,6 +40,7 @@ extension AppDelegate { } } +#if NETWORK_PROTECTION private func checkNetworkProtectionWaitlist() { VPNWaitlist.shared.fetchInviteCodeIfAvailable { [weak self] error in guard error == nil else { @@ -60,6 +65,7 @@ extension AppDelegate { self?.fetchVPNWaitlistAuthToken(inviteCode: inviteCode) } } +#endif private func checkWaitlistBackgroundTasks() { BGTaskScheduler.shared.getPendingTaskRequests { tasks in @@ -68,10 +74,12 @@ extension AppDelegate { WindowsBrowserWaitlist.shared.scheduleBackgroundRefreshTask() } +#if NETWORK_PROTECTION let hasVPNWaitlistTask = tasks.contains { $0.identifier == VPNWaitlist.backgroundRefreshTaskIdentifier } if !hasVPNWaitlistTask { VPNWaitlist.shared.scheduleBackgroundRefreshTask() } +#endif } } diff --git a/DuckDuckGo/AppDelegate.swift b/DuckDuckGo/AppDelegate.swift index e900c44de9..d1cde9067b 100644 --- a/DuckDuckGo/AppDelegate.swift +++ b/DuckDuckGo/AppDelegate.swift @@ -304,7 +304,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // Having both in `didBecomeActive` can sometimes cause the exception when running on a physical device, so registration happens here. AppConfigurationFetch.registerBackgroundRefreshTaskHandler() WindowsBrowserWaitlist.shared.registerBackgroundRefreshTaskHandler() + +#if NETWORK_PROTECTION VPNWaitlist.shared.registerBackgroundRefreshTaskHandler() +#endif RemoteMessaging.registerBackgroundRefreshTaskHandler( bookmarksDatabase: bookmarksDatabase, diff --git a/DuckDuckGo/NetworkProtectionAccessController.swift b/DuckDuckGo/NetworkProtectionAccessController.swift index 3664e3328d..2ae85b7691 100644 --- a/DuckDuckGo/NetworkProtectionAccessController.swift +++ b/DuckDuckGo/NetworkProtectionAccessController.swift @@ -17,6 +17,8 @@ // limitations under the License. // +#if NETWORK_PROTECTION + import Foundation import BrowserServicesKit import ContentBlocking @@ -119,3 +121,5 @@ struct NetworkProtectionAccessController: NetworkProtectionAccess { } } + +#endif diff --git a/DuckDuckGo/SettingsViewController.swift b/DuckDuckGo/SettingsViewController.swift index 09c25f3776..3a8a70a8a6 100644 --- a/DuckDuckGo/SettingsViewController.swift +++ b/DuckDuckGo/SettingsViewController.swift @@ -183,7 +183,10 @@ class SettingsViewController: UITableViewController { configureMacBrowserWaitlistCell() configureWindowsBrowserWaitlistCell() configureSyncCell() + +#if NETWORK_PROTECTION updateNetPCellSubtitle(connectionStatus: connectionObserver.recentValue) +#endif // Make sure multiline labels are correctly presented tableView.setNeedsLayout() diff --git a/DuckDuckGo/VPNWaitlist.swift b/DuckDuckGo/VPNWaitlist.swift index 5c567337e1..66ebc3e278 100644 --- a/DuckDuckGo/VPNWaitlist.swift +++ b/DuckDuckGo/VPNWaitlist.swift @@ -17,6 +17,8 @@ // limitations under the License. // +#if NETWORK_PROTECTION + import Foundation import BrowserServicesKit import Combine @@ -123,3 +125,5 @@ extension WaitlistViewModel.ViewCustomAction { static var openNetworkProtectionPrivacyPolicyScreen = WaitlistViewModel.ViewCustomAction(identifier: "openNetworkProtectionPrivacyPolicyScreen") static var acceptNetworkProtectionTerms = WaitlistViewModel.ViewCustomAction(identifier: "acceptNetworkProtectionTerms") } + +#endif diff --git a/DuckDuckGo/VPNWaitlistDebugViewController.swift b/DuckDuckGo/VPNWaitlistDebugViewController.swift index 2463123e71..6b3fa717ef 100644 --- a/DuckDuckGo/VPNWaitlistDebugViewController.swift +++ b/DuckDuckGo/VPNWaitlistDebugViewController.swift @@ -17,6 +17,8 @@ // limitations under the License. // +#if NETWORK_PROTECTION + import UIKit import Core import BackgroundTasks @@ -193,3 +195,5 @@ final class VPNWaitlistDebugViewController: UITableViewController { tableView.reloadData() } } + +#endif diff --git a/DuckDuckGo/VPNWaitlistView.swift b/DuckDuckGo/VPNWaitlistView.swift index 9c757586d4..bf53b87467 100644 --- a/DuckDuckGo/VPNWaitlistView.swift +++ b/DuckDuckGo/VPNWaitlistView.swift @@ -17,6 +17,8 @@ // limitations under the License. // +#if NETWORK_PROTECTION + import SwiftUI import Core import Waitlist @@ -387,3 +389,5 @@ private extension Text { } } + +#endif diff --git a/DuckDuckGo/VPNWaitlistViewController.swift b/DuckDuckGo/VPNWaitlistViewController.swift index d866432142..c0e2113ee1 100644 --- a/DuckDuckGo/VPNWaitlistViewController.swift +++ b/DuckDuckGo/VPNWaitlistViewController.swift @@ -17,6 +17,8 @@ // limitations under the License. // +#if NETWORK_PROTECTION + import UIKit import SwiftUI import LinkPresentation @@ -156,3 +158,5 @@ extension VPNWaitlistViewController: WaitlistViewModelDelegate { } } + +#endif