Skip to content

Commit

Permalink
Merge branch 'main' into bunn/aichat/poc
Browse files Browse the repository at this point in the history
# Conflicts:
#	DuckDuckGo/TabViewControllerBrowsingMenuExtension.swift
  • Loading branch information
Bunn committed Nov 25, 2024
2 parents 5214318 + 8925890 commit 83515c8
Show file tree
Hide file tree
Showing 196 changed files with 5,565 additions and 2,829 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ jobs:

steps:

- name: Assert main branch
run: |
case "${{ github.ref }}" in
*main) ;;
*) echo "👎 Not main branch"; exit 1 ;;
esac
- name: Register SSH keys for access to certificates
uses: webfactory/[email protected]
with:
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: |
set -o pipefail && xcodebuild \
-scheme "DuckDuckGo" \
-destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" \
-destination "platform=iOS Simulator,name=iPhone 16,OS=18.1" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
Expand Down Expand Up @@ -95,17 +95,17 @@ jobs:
run: |
export PATH="$PATH":"$HOME/.maestro/bin"; maestro cloud --apiKey ${{ secrets.MAESTRO_CLOUD_API_KEY }} -e ONBOARDING_COMPLETED=true --fail-on-timeout=true --fail-on-cancellation=true --timeout=150 --ios-version=17 --include-tags=${{ matrix.test-tag }} DerivedData/Build/Products/Debug-iphonesimulator/DuckDuckGo.app .maestro/
notify-failure:
name: Notify on failure
if: ${{ always() && contains(join(needs.*.result, ','), 'failure') && github.ref_name == 'main' }}
needs: [build-end-to-end-tests, end-to-end-tests]
runs-on: ubuntu-latest
# notify-failure:
# name: Notify on failure
# if: ${{ always() && contains(join(needs.*.result, ','), 'failure') && github.ref_name == 'main' }}
# needs: [build-end-to-end-tests, end-to-end-tests]
# runs-on: ubuntu-latest

steps:
- name: Create Asana task when workflow failed
run: |
curl -s "https://app.asana.com/api/1.0/tasks" \
--header "Accept: application/json" \
--header "Authorization: Bearer ${{ secrets.ASANA_ACCESS_TOKEN }}" \
--header "Content-Type: application/json" \
--data ' { "data": { "name": "GH Workflow Failure - End to end tests", "workspace": "${{ vars.GH_ASANA_WORKSPACE_ID }}", "projects": [ "${{ vars.GH_ASANA_IOS_APP_PROJECT_ID }}" ], "notes" : "The end to end workflow has failed. See https://github.com/duckduckgo/iOS/actions/runs/${{ github.run_id }}. For instructions on how to handle the failure(s), check https://app.asana.com/0/0/1206423571874502/f" } }'
# steps:
# - name: Create Asana task when workflow failed
# run: |
# curl -s "https://app.asana.com/api/1.0/tasks" \
# --header "Accept: application/json" \
# --header "Authorization: Bearer ${{ secrets.ASANA_ACCESS_TOKEN }}" \
# --header "Content-Type: application/json" \
# --data ' { "data": { "name": "GH Workflow Failure - End to end tests", "workspace": "${{ vars.GH_ASANA_WORKSPACE_ID }}", "projects": [ "${{ vars.GH_ASANA_IOS_APP_PROJECT_ID }}" ], "notes" : "The end to end workflow has failed. See https://github.com/duckduckgo/iOS/actions/runs/${{ github.run_id }}. For instructions on how to handle the failure(s), check https://app.asana.com/0/0/1206423571874502/f" } }'
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
run: |
set -o pipefail && xcodebuild test \
-scheme "AtbUITests" \
-destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" \
-destination "platform=iOS Simulator,name=iPhone 16,OS=18.1" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
run: |
set -o pipefail && xcodebuild test \
-scheme "FingerprintingUITests" \
-destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" \
-destination "platform=iOS Simulator,name=iPhone 16,OS=18.1" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:

name: Unit Tests

runs-on: macos-14-xlarge
timeout-minutes: 15
runs-on: macos-15
timeout-minutes: 20

outputs:
commit_author: ${{ steps.fetch_commit_author.outputs.commit_author }}
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
run: |
set -o pipefail && xcodebuild test \
-scheme "DuckDuckGo" \
-destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" \
-destination "platform=iOS Simulator,name=iPhone 16,OS=18.1" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
# Dependabot doesn't have access to all secrets, so we skip this job
if: github.actor != 'dependabot[bot]'

runs-on: macos-14-xlarge
runs-on: macos-15
timeout-minutes: 30

steps:
Expand Down Expand Up @@ -185,7 +185,7 @@ jobs:
set -o pipefail && xcodebuild \
-scheme "DuckDuckGo" \
-destination "platform=iOS Simulator,name=iPhone 15" \
-destination "platform=iOS Simulator,name=iPhone 16" \
-derivedDataPath "DerivedData" \
-configuration "Release" \
-skipPackagePluginValidation \
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/sync-end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: |
set -o pipefail && xcodebuild \
-scheme "DuckDuckGo" \
-destination "platform=iOS Simulator,name=iPhone 15" \
-destination "platform=iOS Simulator,name=iPhone 16" \
-derivedDataPath "DerivedData" \
-skipPackagePluginValidation \
-skipMacroValidation \
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
timeout-minutes: 90
strategy:
matrix:
os-version: [15, 16, 17]
os-version: [17] #[15, 16, 17]
max-parallel: 1 # Uncomment this line to run tests sequentially.
fail-fast: false

Expand Down Expand Up @@ -108,20 +108,20 @@ jobs:
run: |
git checkout .maestro/config.yaml
notify-failure:
name: Notify on failure
if: ${{ always() && contains(join(needs.*.result, ','), 'failure') && github.ref_name == 'main' }}
needs: [build-for-sync-end-to-end-tests, sync-end-to-end-tests]
runs-on: ubuntu-latest
# notify-failure:
# name: Notify on failure
# if: ${{ always() && contains(join(needs.*.result, ','), 'failure') && github.ref_name == 'main' }}
# needs: [build-for-sync-end-to-end-tests, sync-end-to-end-tests]
# runs-on: ubuntu-latest

steps:
- name: Create Asana task when workflow failed
run: |
curl -s "https://app.asana.com/api/1.0/tasks" \
--header "Accept: application/json" \
--header "Authorization: Bearer ${{ secrets.ASANA_ACCESS_TOKEN }}" \
--header "Content-Type: application/json" \
--data ' { "data": { "name": "GH Workflow Failure - Sync End to end tests", "workspace": "${{ vars.GH_ASANA_WORKSPACE_ID }}", "projects": [ "${{ vars.GH_ASANA_IOS_APP_PROJECT_ID }}" ], "notes" : "The end to end workflow has failed. See https://github.com/duckduckgo/iOS/actions/runs/${{ github.run_id }}" } }'
# steps:
# - name: Create Asana task when workflow failed
# run: |
# curl -s "https://app.asana.com/api/1.0/tasks" \
# --header "Accept: application/json" \
# --header "Authorization: Bearer ${{ secrets.ASANA_ACCESS_TOKEN }}" \
# --header "Content-Type: application/json" \
# --data ' { "data": { "name": "GH Workflow Failure - Sync End to end tests", "workspace": "${{ vars.GH_ASANA_WORKSPACE_ID }}", "projects": [ "${{ vars.GH_ASANA_IOS_APP_PROJECT_ID }}" ], "notes" : "The end to end workflow has failed. See https://github.com/duckduckgo/iOS/actions/runs/${{ github.run_id }}" } }'



Expand Down
6 changes: 3 additions & 3 deletions .maestro/setup_ui_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ source $(dirname $0)/common.sh
## Constants

# The simulator command requires the hyphens
target_device="iPhone-15"
target_os="iOS-17-0"
target_device="iPhone-16"
target_os="iOS-18-1"

## Functions

Expand Down Expand Up @@ -50,7 +50,7 @@ build_app() {
echo "⏲️ Building the app"
set -o pipefail && xcodebuild -project "$project_root"/DuckDuckGo.xcodeproj \
-scheme "DuckDuckGo" \
-destination "platform=iOS Simulator,name=iPhone 15,OS=17.2" \
-destination "platform=iOS Simulator,name=iPhone 16,OS=18.1" \
-derivedDataPath "$derived_data_path" \
-skipPackagePluginValidation \
-skipMacroValidation \
Expand Down
4 changes: 3 additions & 1 deletion .maestro/shared/remove_local_logins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ appId: com.duckduckgo.mobile.ios
---

- tapOn: Settings
- scrollUntilVisible:
element: Passwords
- tapOn: Passwords
- tapOn: Passcode field
- inputText: "0000"
Expand All @@ -10,4 +12,4 @@ appId: com.duckduckgo.mobile.ios
- tapOn: Delete Password
- tapOn: Delete Password
- tapOn: Settings
- tapOn: Done
- tapOn: Done
2 changes: 1 addition & 1 deletion .xcode-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15.4
16.1
2 changes: 1 addition & 1 deletion Configuration/Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MARKETING_VERSION = 7.144.0
MARKETING_VERSION = 7.146.0
4 changes: 2 additions & 2 deletions Core/AppPrivacyConfigurationDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import BrowserServicesKit
final public class AppPrivacyConfigurationDataProvider: EmbeddedDataProvider {

public struct Constants {
public static let embeddedDataETag = "\"516f95a16f7a556c58e14ee6f193cc30\""
public static let embeddedDataSHA = "87314e1ac02784472a722844a27b443b0387a164ac72afaac00d9a70731fc572"
public static let embeddedDataETag = "\"d4536be677d4324aa872d0e59d6fd4fa\""
public static let embeddedDataSHA = "a9cce4d5c3430bc3bbca33ad26aa980dcc1c0e792b71ce2696f4483401efbf72"
}

public var embeddedDataEtag: String {
Expand Down
4 changes: 4 additions & 0 deletions Core/BoolFileMarkerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ final class BoolFileMarkerTests: XCTestCase {
let fileURL = try XCTUnwrap(testFileURL)

let attributes = try FileManager.default.attributesOfItem(atPath: fileURL.path)
#if targetEnvironment(simulator)
XCTAssertNil(attributes[.protectionKey])
#else
XCTAssertEqual(attributes[.protectionKey] as? FileProtectionType, FileProtectionType.none)
#endif
XCTAssertTrue(FileManager.default.fileExists(atPath: fileURL.path))
XCTAssertEqual(marker.isPresent, true)
}
Expand Down
4 changes: 2 additions & 2 deletions Core/CookieStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public class CookieStorage {

/// Update ALL cookies. The absence of cookie domains here indicateds they have been removed by the website, so be sure to call this with all cookies that might need to be persisted even if those websites have not been visited yet.
@discardableResult
func updateCookies(_ cookies: [HTTPCookie], keepingPreservedLogins preservedLogins: PreserveLogins) -> CookieDomainsOnUpdateDiagnostic {
func updateCookies(_ cookies: [HTTPCookie], preservingFireproofedDomains fireproofing: Fireproofing) -> CookieDomainsOnUpdateDiagnostic {
guard isConsumed else { return .notConsumed }

isConsumed = false
Expand Down Expand Up @@ -130,7 +130,7 @@ public class CookieStorage {
persistedCookiesByDomain.keys.forEach {
guard !URL.isDuckDuckGo(domain: $0) else { return } // DDG cookies are for SERP settings only

if !preservedLogins.isAllowed(cookieDomain: $0) {
if !fireproofing.isAllowed(cookieDomain: $0) {
persistedCookiesByDomain.removeValue(forKey: $0)
}
}
Expand Down
31 changes: 31 additions & 0 deletions Core/FaviconHasher.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// FaviconHasher.swift
// DuckDuckGo
//
// 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.
//


import Foundation
import Kingfisher

public struct FaviconHasher {

static let salt = "DDGSalt:"
public static func createHash(ofDomain domain: String) -> String {
return "\(Self.salt)\(domain)".sha256()
}

}
1 change: 1 addition & 0 deletions Core/FaviconRequestModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// limitations under the License.
//

import Core
import Kingfisher

class FaviconRequestModifier: ImageDownloadRequestModifier {
Expand Down
43 changes: 43 additions & 0 deletions Core/FaviconsCacheType.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// FaviconsCacheType.swift
// DuckDuckGo
//
// 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.
//

import Foundation

public enum FaviconsCacheType: String {

static let faviconsFolderName = "Favicons"

case tabs
case fireproof

public func cacheLocation() -> URL? {
return baseCacheURL()?.appendingPathComponent(Self.faviconsFolderName)
}

private func baseCacheURL() -> URL? {
switch self {
case .fireproof:
let groupName = BookmarksDatabase.Constants.bookmarksGroupID
return FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: groupName)

case .tabs:
return FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first
}
}
}
34 changes: 0 additions & 34 deletions Core/FaviconsHelper.swift

This file was deleted.

Loading

0 comments on commit 83515c8

Please sign in to comment.