Skip to content

Commit

Permalink
Merge branch 'main' into sam/remove-netp-notification-pixels
Browse files Browse the repository at this point in the history
* main:
  DBP: Implement exponential backoff for optout retries (#2815)
  Update UI Tests CI workflows for macOS 13/14 (#2835)
  Display the addresses in the Debugger UI (#2828)
  Removing temporary password manager survey code (#2834)
  Surface specific XPC & login item errors (#2773)
  DuckPlayer PiP settings (#2830)
  • Loading branch information
samsymons committed Jun 5, 2024
2 parents e2f2313 + 05bc6ef commit 1d6ed60
Show file tree
Hide file tree
Showing 48 changed files with 629 additions and 214 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
- name: Cache SPM
if: env.cache_key_hash
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: DerivedData/SourcePackages
key: ${{ runner.os }}-spm-${{ matrix.cache-key }}${{ env.cache_key_hash }}
Expand Down Expand Up @@ -323,7 +323,7 @@ jobs:
- name: Cache SPM
if: env.cache_key_hash
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: DerivedData/SourcePackages
key: ${{ runner.os }}-spm-test-release-${{ env.cache_key_hash }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync_end_to_end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Cache SPM
if: env.cache_key_hash
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: DerivedData/SourcePackages
key: ${{ runner.os }}-spm-${{ env.cache_key_hash }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync_end_to_end_legacy_os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- name: Cache SPM
if: env.cache_key_hash
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: DerivedData/SourcePackages
key: ${{ runner.os }}-spm-${{ env.cache_key_hash }}
Expand Down
32 changes: 24 additions & 8 deletions .github/workflows/ui_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Cache SPM
if: env.cache_key_hash
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: DerivedData/SourcePackages
key: ${{ runner.os }}-spm-${{ env.cache_key_hash }}
Expand All @@ -60,22 +60,33 @@ jobs:
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_$(<.xcode-version).app/Contents/Developer

- name: Build and run UI Testing
- name: Build for testing
run: |
defaults write com.duckduckgo.macos.browser.review moveToApplicationsFolderAlertSuppress 1
defaults write com.duckduckgo.macos.browser.review onboarding.finished -bool true
set -o pipefail && xcodebuild test \
set -o pipefail && xcodebuild build-for-testing \
-scheme "UI Tests" \
-configuration Review \
-derivedDataPath DerivedData \
-skipPackagePluginValidation \
-skipMacroValidation \
| tee xcodebuild.log \
| xcbeautify
- name: Run UI Tests
run: |
set -o pipefail && xcodebuild test-without-building \
-scheme "UI Tests" \
-configuration Review \
-derivedDataPath DerivedData \
-skipPackagePluginValidation \
-skipMacroValidation \
-test-iterations 2 \
-retry-tests-on-failure \
| tee xcodebuild.log \
| xcbeautify --report junit --report-path . --junit-report-filename ui-tests.xml
| tee -a xcodebuild.log \
| tee ui-tests.log
# - name: Create Asana task when workflow failed
# - name: Create Asana task when workflow failed
# if: ${{ failure() }} && github.ref == 'refs/heads/main'
# run: |
# curl -s "https://app.asana.com/api/1.0/tasks" \
Expand All @@ -84,6 +95,11 @@ jobs:
# --header "Content-Type: application/json" \
# --data ' { "data": { "name": "GH Workflow Failure - UI Tests", "projects": [ "${{ vars.MACOS_APP_DEVELOPMENT_ASANA_PROJECT_ID }}" ], "notes" : "The end to end workflow has failed. See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" } }'

- name: Prepare test report
if: always()
run: |
xcbeautify --report junit --report-path . --junit-report-filename ui-tests.xml < ui-tests.log
- name: Publish tests report
uses: mikepenz/action-junit-report@v4
if: always()
Expand All @@ -93,11 +109,11 @@ jobs:

- name: Upload logs when workflow failed
uses: actions/upload-artifact@v4
if: failure()
if: failure() || cancelled()
with:
name: "BuildLogs ${{ matrix.runner }}"
path: |
xcodebuild.log
DerivedData/Logs/Test/*.xcresult
~/Library/Logs/DiagnosticReports/*
retention-days: 7
retention-days: 1
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12979,7 +12979,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 150.0.0;
version = 150.1.0;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "03e6b719671c5baaa2afa474d447b707bf595820",
"version" : "150.0.0"
"revision" : "79fe0c99e43c6c1bf2c0a4d397368033fd37eae9",
"version" : "150.1.0"
}
},
{
Expand Down

This file was deleted.

This file was deleted.

3 changes: 2 additions & 1 deletion DuckDuckGo/Common/Extensions/NSApplicationExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ extension NSApplication {
return .normal
}
#elseif REVIEW
if ProcessInfo.processInfo.environment["UITEST_MODE"] == "1" {
// UITEST_MODE is set from UI Tests code, CI is always set in CI
if ProcessInfo.processInfo.environment["UITEST_MODE"] == "1" || ProcessInfo.processInfo.environment["CI"] != nil {
return .uiTests
}
return .normal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ import WebKit

extension WKWebViewConfiguration {

var allowsPictureInPictureMediaPlayback: Bool {
get {
return preferences.value(forKey: "allowsPictureInPictureMediaPlayback") as? Bool ?? false
}
set {
preferences.setValue(newValue, forKey: "allowsPictureInPictureMediaPlayback")
}
}

@MainActor
func applyStandardConfiguration(contentBlocking: some ContentBlockingProtocol, burnerMode: BurnerMode) {
if case .burner(let websiteDataStore) = burnerMode {
Expand All @@ -34,7 +43,11 @@ extension WKWebViewConfiguration {
} else {
preferences.setValue(true, forKey: "fullScreenEnabled")
}
preferences.setValue(true, forKey: "allowsPictureInPictureMediaPlayback")

#if !APPSTORE
allowsPictureInPictureMediaPlayback = true
#endif

preferences.setValue(true, forKey: "developerExtrasEnabled")
preferences.setValue(false, forKey: "backspaceKeyNavigationEnabled")
preferences.javaScriptCanOpenWindowsAutomatically = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extension UserText {
}

// "network.protection.system.extension.unknown.activation.error" - Message shown to users when they try to enable NetP and there is an unexpected activation error.
static let networkProtectionUnknownActivationError = "There as an unexpected error. Please try again."
static let networkProtectionUnknownActivationError = "There was an unexpected error. Please try again."
// "network.protection.system.extension.please.reboot" - Message shown to users when they try to enable NetP and they need to reboot the computer to complete the installation
static let networkProtectionPleaseReboot = "VPN update available. Restart your Mac to reconnect."
}
Expand Down
27 changes: 0 additions & 27 deletions DuckDuckGo/Common/Surveys/SurveyURLBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import Foundation
import Common
import BrowserServicesKit
import Subscription

final class SurveyURLBuilder {
Expand Down Expand Up @@ -159,23 +158,6 @@ final class SurveyURLBuilder {
return components.url
}

func buildSurveyURLWithPasswordsCountSurveyParameter(from originalURLString: String) -> URL? {
let surveyURLWithParameters = buildSurveyURL(from: originalURLString)

guard let surveyURLWithParametersString = surveyURLWithParameters?.absoluteString,
var components = URLComponents(string: surveyURLWithParametersString),
let bucket = passwordsCountBucket() else {
return surveyURLWithParameters
}

var queryItems = components.queryItems ?? []
queryItems.append(URLQueryItem(name: "saved_passwords", value: bucket))

components.queryItems = queryItems

return components.url
}

private func queryItem(parameter: SurveyURLParameters, value: String) -> URLQueryItem {
let urlAllowed: CharacterSet = .alphanumerics.union(.init(charactersIn: "-._~"))
let sanitizedValue = value.addingPercentEncoding(withAllowedCharacters: urlAllowed)
Expand All @@ -186,15 +168,6 @@ final class SurveyURLBuilder {
return URLQueryItem(name: parameter.rawValue, value: String(describing: value))
}

private func passwordsCountBucket() -> String? {
guard let secureVault = try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter.shared),
let bucket = try? secureVault.accountsCountBucket() else {
return nil
}

return bucket
}

private func daysSince(date storedDate: Date) -> Int? {
if let days = Calendar.current.dateComponents([.day], from: storedDate, to: Date()).day {
return abs(days)
Expand Down
1 change: 0 additions & 1 deletion DuckDuckGo/Common/Utilities/UserDefaultsWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public struct UserDefaultsWrapper<T> {
case askToSavePaymentMethods = "preferences.ask-to-save.payment-methods"
case autolockLocksFormFilling = "preferences.lock-autofill-form-fill"
case autofillDebugScriptEnabled = "preferences.enable-autofill-debug-script"
case autofillSurveyEnabled = "preferences.enable-autofill-survey"

case saveAsPreferredFileType = "saveAs.selected.filetype"

Expand Down
7 changes: 5 additions & 2 deletions DuckDuckGo/MainWindow/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ final class MainViewController: NSViewController {
#endif

let ipcClient = TunnelControllerIPCClient()
ipcClient.register()
ipcClient.register { error in
NetworkProtectionKnownFailureStore().lastKnownFailure = KnownFailure(error)
}
let vpnUninstaller = VPNUninstaller(ipcClient: ipcClient)

return NetworkProtectionNavBarPopoverManager(
Expand All @@ -97,7 +99,8 @@ final class MainViewController: NSViewController {
connectionErrorObserver: ipcClient.ipcConnectionErrorObserver,
connectivityIssuesObserver: connectivityIssuesObserver,
controllerErrorMessageObserver: controllerErrorMessageObserver,
dataVolumeObserver: ipcClient.ipcDataVolumeObserver
dataVolumeObserver: ipcClient.ipcDataVolumeObserver,
knownFailureObserver: KnownFailureObserverThroughDistributedNotifications()
)
}()

Expand Down
Loading

0 comments on commit 1d6ed60

Please sign in to comment.