Skip to content

Commit

Permalink
Merge branch 'main' into sam/vpn-clean-up
Browse files Browse the repository at this point in the history
# By Dax the Duck (5) and others
# Via GitHub (4) and Michal Smaga (1)
* main: (24 commits)
  Validate VPN errors before re-throwing them (#3490)
  Allowing users to delete suggestions (#3430)
  Bump version to 1.112.0 (296)
  Marking latest Bitwarden versions as incompatible (#3492)
  Bump version to 1.112.0 (295)
  Update to subscription cookie (#3489)
  Bug Fix: Phishing Detection Dataset Discrepancies (#3440)
  Bump version to 1.112.0 (294)
  Fix crash when opening permission popover for NewTab page address bar (#3484)
  Set version_check_wait_retry_limit to 1 (#3488)
  Refactor automatic update flow to use custom Sparkle user driver (#3274)
  Add to Dock - Update BSK version (#3479)
  Freemium PIR: Manual Removal Links (#3466)
  Fix Sync E2E tests (#3486)
  Fix crash on empty bookmarks html root element (#3482)
  update UI test (#3469)
  Update BSK with autofill 15.1.0 (#3480)
  Bump version to 1.112.0 (293)
  New tagline (#3401)
  add system info to webkit termination validation (#3473)
  ...

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
  • Loading branch information
samsymons committed Nov 4, 2024
2 parents 50ebfc7 + 9184e92 commit c4629fa
Show file tree
Hide file tree
Showing 95 changed files with 2,199 additions and 825 deletions.
2 changes: 1 addition & 1 deletion Configuration/BuildNumber.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 291
CURRENT_PROJECT_VERSION = 296
36 changes: 22 additions & 14 deletions DuckDuckGo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/content-scope-scripts",
"state" : {
"revision" : "b74549bd869fdecc16fad851f2f608b1724764df",
"version" : "6.25.0"
"revision" : "48fee2508995d4ac02d18b3d55424adedcb4ce4f",
"version" : "6.28.0"
}
},
{
"identity" : "duckduckgo-autofill",
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/duckduckgo-autofill.git",
"state" : {
"revision" : "945ac09a0189dc6736db617867fde193ea984b20",
"version" : "15.0.0"
"revision" : "c992041d16ec10d790e6204dce9abf9966d1363c",
"version" : "15.1.0"
}
},
{
Expand All @@ -75,7 +75,7 @@
{
"identity" : "lottie-spm",
"kind" : "remoteSourceControl",
"location" : "https://github.com/airbnb/lottie-spm",
"location" : "https://github.com/airbnb/lottie-spm.git",
"state" : {
"revision" : "1d29eccc24cc8b75bff9f6804155112c0ffc9605",
"version" : "4.4.3"
Expand Down Expand Up @@ -104,8 +104,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/privacy-dashboard",
"state" : {
"revision" : "9de2b2aa317a48d3ee31116dc15b0feeb2cc9414",
"version" : "5.3.0"
"revision" : "53fd1a0f8d91fcf475d9220f810141007300dffd",
"version" : "7.1.1"
}
},
{
Expand Down Expand Up @@ -167,8 +167,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/sync_crypto",
"state" : {
"revision" : "2ab6ab6f0f96b259c14c2de3fc948935fc16ac78",
"version" : "0.2.0"
"revision" : "0c8bf3c0e75591bc366407b9d7a73a9fcfc7736f",
"version" : "0.3.0"
}
},
{
Expand Down
38 changes: 35 additions & 3 deletions DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate {

public let subscriptionManager: SubscriptionManager
public let subscriptionUIHandler: SubscriptionUIHandling
public let subscriptionCookieManager: SubscriptionCookieManaging
private let subscriptionCookieManager: SubscriptionCookieManaging
private var subscriptionCookieManagerFeatureFlagCancellable: AnyCancellable?

// MARK: - Freemium DBP
public let freemiumDBPFeature: FreemiumDBPFeature
Expand Down Expand Up @@ -325,6 +326,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
freemiumDBPFeature.subscribeToDependencyUpdates()
}

// swiftlint:disable:next cyclomatic_complexity
func applicationDidFinishLaunching(_ notification: Notification) {
guard NSApp.runType.requiresEnvironment else { return }
defer {
Expand Down Expand Up @@ -367,6 +369,30 @@ final class AppDelegate: NSObject, NSApplicationDelegate {

subscriptionManager.loadInitialData()

let privacyConfigurationManager = ContentBlocking.shared.privacyConfigurationManager

// Enable subscriptionCookieManager if feature flag is present
if privacyConfigurationManager.privacyConfig.isSubfeatureEnabled(PrivacyProSubfeature.setAccessTokenCookieForSubscriptionDomains) {
subscriptionCookieManager.enableSettingSubscriptionCookie()
}

// Keep track of feature flag changes
subscriptionCookieManagerFeatureFlagCancellable = privacyConfigurationManager.updatesPublisher
.sink { [weak self, weak privacyConfigurationManager] in
guard let self, let privacyConfigurationManager else { return }

let isEnabled = privacyConfigurationManager.privacyConfig.isSubfeatureEnabled(PrivacyProSubfeature.setAccessTokenCookieForSubscriptionDomains)

Task { [weak self] in
if isEnabled {
self?.subscriptionCookieManager.enableSettingSubscriptionCookie()
await self?.subscriptionCookieManager.refreshSubscriptionCookie()
} else {
await self?.subscriptionCookieManager.disableSettingSubscriptionCookie()
}
}
}

if [.normal, .uiTests].contains(NSApp.runType) {
stateRestorationManager.applicationDidFinishLaunching()
}
Expand Down Expand Up @@ -465,8 +491,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
guard didFinishLaunching else { return }

PixelExperiment.fireOnboardingTestPixels()
syncService?.initializeIfNeeded()
syncService?.scheduler.notifyAppLifecycleEvent()
initializeSync()

NetworkProtectionAppEvents(featureGatekeeper: DefaultVPNFeatureGatekeeper(subscriptionManager: subscriptionManager)).applicationDidBecomeActive()

Expand All @@ -492,6 +517,13 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
}
}

private func initializeSync() {
guard let syncService else { return }
syncService.initializeIfNeeded()
syncService.scheduler.notifyAppLifecycleEvent()
SyncDiagnosisHelper(syncService: syncService).diagnoseAccountStatus()
}

func applicationDidResignActive(_ notification: Notification) {
Task { @MainActor in
await vpnRedditSessionWorkaround.removeRedditSessionWorkaround()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions DuckDuckGo/Assets.xcassets/Images/Check.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Check-Color-16.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Icon 22.pdf",
"filename" : "Exclamation-High-Color-16.svg",
"idiom" : "universal"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Document-Color-16.pdf",
"filename" : "Release-Notes-Color-16.svg",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Icon 19.pdf",
"filename" : "Exclamation-Color-16-2.svg",
"idiom" : "universal"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
6 changes: 6 additions & 0 deletions DuckDuckGo/Common/Extensions/NSViewExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ extension NSView {
set { isHidden = !newValue }
}

var isVisible: Bool {
guard !isHiddenOrHasHiddenAncestor,
let window, window.isVisible else { return false }
return true
}

func makeMeFirstResponder() {
guard let window = window else {
Logger.general.error("\(self.className): Window not available")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ extension NSPopover {
// https://app.asana.com/0/1201037661562251/1206407295280737/f
@objc(swizzled_showRelativeToRect:ofView:preferredEdge:)
private dynamic func swizzled_show(relativeTo positioningRect: NSRect, of positioningView: NSView, preferredEdge: NSRectEdge) {
if positioningView.superview == nil {
if positioningView.window == nil {
var observer: Cancellable?
observer = positioningView.observe(\.window) { positioningView, _ in
if positioningView.window != nil {
Expand Down
27 changes: 27 additions & 0 deletions DuckDuckGo/Common/Extensions/XMLNodeExtension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// XMLNodeExtension.swift
//
// Copyright © 2024 DuckDuckGo. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

extension XMLNode {

func childIfExists(at index: Int) -> XMLNode? {
assert(index >= 0)
guard childCount > index else { return nil }
return child(at: index)
}

}
Loading

0 comments on commit c4629fa

Please sign in to comment.