Skip to content

Commit

Permalink
Fix release build compilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
samsymons committed Nov 16, 2023
1 parent a1c66d1 commit c6d40b4
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 0 deletions.
8 changes: 8 additions & 0 deletions DuckDuckGo/AppDelegate+Waitlists.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ extension AppDelegate {

func checkWaitlists() {
checkWindowsWaitlist()

#if NETWORK_PROTECTION
checkNetworkProtectionWaitlist()
#endif
checkWaitlistBackgroundTasks()

}

private func checkWindowsWaitlist() {
Expand All @@ -36,6 +40,7 @@ extension AppDelegate {
}
}

#if NETWORK_PROTECTION
private func checkNetworkProtectionWaitlist() {
VPNWaitlist.shared.fetchInviteCodeIfAvailable { [weak self] error in
guard error == nil else {
Expand All @@ -60,6 +65,7 @@ extension AppDelegate {
self?.fetchVPNWaitlistAuthToken(inviteCode: inviteCode)
}
}
#endif

private func checkWaitlistBackgroundTasks() {
BGTaskScheduler.shared.getPendingTaskRequests { tasks in
Expand All @@ -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
}
}

Expand Down
3 changes: 3 additions & 0 deletions DuckDuckGo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions DuckDuckGo/NetworkProtectionAccessController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// limitations under the License.
//

#if NETWORK_PROTECTION

import Foundation
import BrowserServicesKit
import ContentBlocking
Expand Down Expand Up @@ -119,3 +121,5 @@ struct NetworkProtectionAccessController: NetworkProtectionAccess {
}

}

#endif
3 changes: 3 additions & 0 deletions DuckDuckGo/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions DuckDuckGo/VPNWaitlist.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// limitations under the License.
//

#if NETWORK_PROTECTION

import Foundation
import BrowserServicesKit
import Combine
Expand Down Expand Up @@ -123,3 +125,5 @@ extension WaitlistViewModel.ViewCustomAction {
static var openNetworkProtectionPrivacyPolicyScreen = WaitlistViewModel.ViewCustomAction(identifier: "openNetworkProtectionPrivacyPolicyScreen")
static var acceptNetworkProtectionTerms = WaitlistViewModel.ViewCustomAction(identifier: "acceptNetworkProtectionTerms")
}

#endif
4 changes: 4 additions & 0 deletions DuckDuckGo/VPNWaitlistDebugViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// limitations under the License.
//

#if NETWORK_PROTECTION

import UIKit
import Core
import BackgroundTasks
Expand Down Expand Up @@ -193,3 +195,5 @@ final class VPNWaitlistDebugViewController: UITableViewController {
tableView.reloadData()
}
}

#endif
4 changes: 4 additions & 0 deletions DuckDuckGo/VPNWaitlistView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// limitations under the License.
//

#if NETWORK_PROTECTION

import SwiftUI
import Core
import Waitlist
Expand Down Expand Up @@ -387,3 +389,5 @@ private extension Text {
}

}

#endif
4 changes: 4 additions & 0 deletions DuckDuckGo/VPNWaitlistViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// limitations under the License.
//

#if NETWORK_PROTECTION

import UIKit
import SwiftUI
import LinkPresentation
Expand Down Expand Up @@ -156,3 +158,5 @@ extension VPNWaitlistViewController: WaitlistViewModelDelegate {
}

}

#endif

0 comments on commit c6d40b4

Please sign in to comment.