Skip to content
This repository has been archived by the owner on Feb 24, 2025. It is now read-only.

Commit

Permalink
Merge branch 'main' into dominik/history-view
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoy committed Feb 7, 2025
2 parents 200167d + 73d58f0 commit 013c42c
Show file tree
Hide file tree
Showing 25 changed files with 422 additions and 31 deletions.
6 changes: 4 additions & 2 deletions DuckDuckGo-macOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -4475,6 +4475,7 @@
9D84E3F42CD4E6660046CD8B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9D84E43C2CD4E66F0046CD8B /* DBPE2ETests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DBPE2ETests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
9D8FA00B2AC5BDCE005DD0D0 /* LoginItem+DataBrokerProtection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "LoginItem+DataBrokerProtection.swift"; sourceTree = "<group>"; };
9D9150F32D53F1F1005B5833 /* DataBrokerProtectionShared */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = DataBrokerProtectionShared; sourceTree = "<group>"; };
9D9AE8682AA76CDC0026E7DC /* LoginItem+NetworkProtection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "LoginItem+NetworkProtection.swift"; sourceTree = "<group>"; };
9D9AE86A2AA76CF90026E7DC /* LoginItemsManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginItemsManager.swift; sourceTree = "<group>"; };
9D9AE8D12AAA39A70026E7DC /* DuckDuckGo Personal Information Removal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DuckDuckGo Personal Information Removal.app"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -6226,6 +6227,7 @@
9D9DE5712C63A96400D20B15 /* AppKitExtensions */,
7B9167A82C09E88800322310 /* AppLauncher */,
378E279D2970217400FCADA2 /* BuildToolPlugins */,
9D9150F32D53F1F1005B5833 /* DataBrokerProtectionShared */,
3192A2702A4C4E330084EA89 /* DataBrokerProtection */,
7B8FDD1E2CDD877000720907 /* FeatureFlags */,
9DF2DB592C73B52F0025F43C /* Freemium */,
Expand Down Expand Up @@ -15695,8 +15697,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
branch = "dominik/history-view";
kind = branch;
kind = exactVersion;
version = 236.0.2;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"branch" : "dominik/history-view",
"revision" : "e6301596044bca29517dae4765855221e3cba523"
"revision" : "8b7cb167b94dea66313175c88234fdc3cd2db306",
"version" : "236.0.2"
}
},
{
"identity" : "content-scope-scripts",
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/content-scope-scripts",
"state" : {
"branch" : "pr-releases/pr-1468",
"revision" : "02d971516751e71bccd3d34b08cfefdbbe7726ef"
"revision" : "1876d68142cf4f9abfaaee235a015d287eb71226",
"version" : "7.17.0"
}
},
{
Expand Down
3 changes: 2 additions & 1 deletion DuckDuckGo/ContentBlocker/ContentBlockerRulesLists.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ final class ContentBlockerRulesLists: DefaultContentBlockerRulesListsSource {
if adClickAttribution.isEnabled,
let tdsRulesIndex = result.firstIndex(where: { $0.name == DefaultContentBlockerRulesListsSource.Constants.trackerDataSetRulesListName }) {
let tdsRules = result[tdsRulesIndex]
let allowlistedTrackerNames = adClickAttribution.allowlist.map { $0.entity }
let allowlist = adClickAttribution.allowlist
let allowlistedTrackerNames = allowlist.map { $0.entity }
let adSplitter = AdClickAttributionRulesSplitter(rulesList: tdsRules, allowlistedTrackerNames: allowlistedTrackerNames)
if let splitRules = adSplitter.split() {
result.remove(at: tdsRulesIndex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ final class VPNURLEventHandler {
PixelKit.fire(PrivacyProPixel.privacyProOfferScreenImpression)
}

func showVPNAppExclusions() {
windowControllerManager.showPreferencesTab(withSelectedPane: .vpn)
windowControllerManager.showVPNAppExclusions()
}

func showVPNDomainExclusions() {
windowControllerManager.showPreferencesTab(withSelectedPane: .vpn)
windowControllerManager.showVPNDomainExclusions()
}

#if !APPSTORE && !DEBUG
func moveAppToApplicationsFolder() {
// this should be run after NSApplication.shared is set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protocol ExcludedAppsModel {
}

final class DefaultExcludedAppsModel {
private let appInfoRetriever: AppInfoRetrieveing = AppInfoRetriever()
private let appInfoRetriever: AppInfoRetrieving = AppInfoRetriever()
let proxySettings = TransparentProxySettings(defaults: .netP)
private let pixelKit: PixelFiring?

Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/Statistics/Experiment/PixelExperiment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ final internal class PixelExperimentLogic {

DispatchQueue.main.async {
let now = self.now()
if now >= AppDelegate.firstLaunchDate.adding(.days(21)) && now <= AppDelegate.firstLaunchDate.adding(.days(27)) {
if now >= AppDelegate.firstLaunchDate.addingTimeInterval(.days(21)) && now <= AppDelegate.firstLaunchDate.addingTimeInterval(.days(27)) {
PixelKit.fire(GeneralPixel.serpDay21to27(cohort: cohort.rawValue), frequency: .legacyInitial, includeAppVersionParameter: false)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,71 @@
import AppKit
import Foundation

public protocol AppInfoRetrieveing {
/// Protocol to provide a mechanism to query information about installed Applications.
///
public protocol AppInfoRetrieving {

/// Provides a structure featuring commonly-used app info.
/// Provides a structure featuring commonly-used app info given the Application's bundleID.
///
/// It's also possible to retrieve the individual information directly by calling other methods in this class.
/// - Parameters:
/// - bundleID: the bundleID of the target Application.
///
func getAppInfo(bundleID: String) -> AppInfo?

/// Provides a structure featuring commonly-used app info, given the Application's URL.
///
/// - Parameters:
/// - appURL: the URL where the target Application is installed.
///
func getAppInfo(appURL: URL) -> AppInfo?

/// Obtains the icon for a specified application.
///
/// - Parameters:
/// - bundleID: the bundleID of the target Application.
///
func getAppIcon(bundleID: String) -> NSImage?

/// Obtains the URL for a specified application.
///
/// - Parameters:
/// - bundleID: the bundleID of the target Application.
///
func getAppURL(bundleID: String) -> URL?

/// Obtains the visible name for a specified application.
///
/// - Parameters:
/// - bundleID: the bundleID of the target Application.
///
func getAppName(bundleID: String) -> String?

/// Obtains the bundleID for a specified application.
///
/// - Parameters:
/// - appURL: the URL where the target Application is installed.
///
func getBundleID(appURL: URL) -> String?

/// Obtains the bundleIDs for all Applications embedded within a speciried application.
///
/// - Parameters:
/// - bundleURL: the URL where the parent Application is installed.
///
func findEmbeddedBundleIDs(in bundleURL: URL) -> Set<String>
}

public class AppInfoRetriever: AppInfoRetrieveing {
/// Provides a mechanism to query information about installed Applications.
///
public class AppInfoRetriever: AppInfoRetrieving {

public init() {}

/// Provides a structure featuring commonly-used app info given the Application's bundleID.
///
/// - Parameters:
/// - bundleID: the bundleID of the target Application.
///
public func getAppInfo(bundleID: String) -> AppInfo? {
guard let appName = getAppName(bundleID: bundleID) else {
return nil
Expand All @@ -46,6 +93,11 @@ public class AppInfoRetriever: AppInfoRetrieveing {
return AppInfo(bundleID: bundleID, name: appName, icon: appIcon)
}

/// Provides a structure featuring commonly-used app info, given the Application's URL.
///
/// - Parameters:
/// - appURL: the URL where the target Application is installed.
///
public func getAppInfo(appURL: URL) -> AppInfo? {
guard let bundleID = getBundleID(appURL: appURL) else {
return nil
Expand All @@ -54,6 +106,11 @@ public class AppInfoRetriever: AppInfoRetrieveing {
return getAppInfo(bundleID: bundleID)
}

/// Obtains the icon for a specified application.
///
/// - Parameters:
/// - bundleID: the bundleID of the target Application.
///
public func getAppIcon(bundleID: String) -> NSImage? {
guard let appURL = NSWorkspace.shared.urlForApplication(withBundleIdentifier: bundleID) else {
return nil
Expand All @@ -72,6 +129,11 @@ public class AppInfoRetriever: AppInfoRetrieveing {
return NSImage(contentsOf: iconURL)
}

/// Obtains the visible name for a specified application.
///
/// - Parameters:
/// - bundleID: the bundleID of the target Application.
///
public func getAppName(bundleID: String) -> String? {
if let appURL = NSWorkspace.shared.urlForApplication(withBundleIdentifier: bundleID) {
// Try reading from Info.plist
Expand All @@ -86,6 +148,20 @@ public class AppInfoRetriever: AppInfoRetrieveing {
return nil
}

/// Obtains the URL for a specified application.
///
/// - Parameters:
/// - bundleID: the bundleID of the target Application.
///
public func getAppURL(bundleID: String) -> URL? {
NSWorkspace.shared.urlForApplication(withBundleIdentifier: bundleID)
}

/// Obtains the bundleID for a specified application.
///
/// - Parameters:
/// - appURL: the URL where the target Application is installed.
///
public func getBundleID(appURL: URL) -> String? {
let infoPlistURL = appURL.appendingPathComponent("Contents/Info.plist")
if let plist = NSDictionary(contentsOf: infoPlistURL),
Expand All @@ -94,4 +170,32 @@ public class AppInfoRetriever: AppInfoRetrieveing {
}
return nil
}

// MARK: - Embedded Bundle IDs

/// Obtains the bundleIDs for all Applications embedded within a speciried application.
///
/// - Parameters:
/// - bundleURL: the URL where the parent Application is installed.
///
public func findEmbeddedBundleIDs(in bundleURL: URL) -> Set<String> {
var bundleIDs: [String] = []
let fileManager = FileManager.default

guard let enumerator = fileManager.enumerator(at: bundleURL,
includingPropertiesForKeys: nil,
options: [.skipsHiddenFiles],
errorHandler: nil) else {
return []
}

for case let fileURL as URL in enumerator where fileURL.pathExtension == "app" {
let embeddedBundle = Bundle(url: fileURL)
if let bundleID = embeddedBundle?.bundleIdentifier {
bundleIDs.append(bundleID)
}
}

return Set(bundleIDs)
}
}
4 changes: 3 additions & 1 deletion LocalPackages/DataBrokerProtection/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ let package = Package(
targets: ["DataBrokerProtection"])
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "236.0.2"),
.package(path: "../DataBrokerProtectionShared"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../AppKitExtensions"),
.package(path: "../XPCHelper"),
Expand All @@ -40,6 +41,7 @@ let package = Package(
name: "DataBrokerProtection",
dependencies: [
.product(name: "BrowserServicesKit", package: "BrowserServicesKit"),
.product(name: "DataBrokerProtectionShared", package: "DataBrokerProtectionShared"),
.product(name: "SwiftUIExtensions", package: "SwiftUIExtensions"),
.product(name: "AppKitExtensions", package: "AppKitExtensions"),
.byName(name: "XPCHelper"),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DataBrokerProtectionTests"
BuildableName = "DataBrokerProtectionTests"
BlueprintName = "DataBrokerProtectionTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Loading

0 comments on commit 013c42c

Please sign in to comment.