Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into alex/fix-address-bar-…
Browse files Browse the repository at this point in the history
…cleared-on-nav
  • Loading branch information
mallexxx committed Feb 19, 2024
2 parents 7ebe607 + 2778f1f commit 543f5ba
Show file tree
Hide file tree
Showing 26 changed files with 138 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_appstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ jobs:
template-name: debug-symbols-uploaded

- name: Send Mattermost message
if: success() || failure() # Don't execute when cancelled
env:
WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
DESTINATION: ${{ env.destination }}
Expand All @@ -158,8 +159,7 @@ jobs:
if [[ -z "${MM_USER_HANDLE}" ]]; then
echo "Mattermost user handle not known for ${{ github.actor }}, skipping sending message"
else
curl -s -H 'Content-type: application/json' \
-d "$(envsubst < ./scripts/assets/appstore-release-mm-template.json)" \
-d "$(envsubst < ./scripts/assets/appstore-release-mm-template.json | jq ".${{ job.status }}")" \
${{ secrets.MM_WEBHOOK_URL }}
fi
14 changes: 12 additions & 2 deletions .github/workflows/build_notarized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,17 @@ jobs:
name: Send Mattermost message

needs: [export-notarized-app, create-dmg]
if: ${{ always() && (needs.export-notarized-app.result == 'success') && (needs.create-dmg.result == 'success' || needs.create-dmg.result == 'skipped') }}
if: always()

runs-on: ubuntu-latest

env:
success: ${{ (needs.export-notarized-app.result == 'success') && (needs.create-dmg.result == 'success' || needs.create-dmg.result == 'skipped') }}
failure: ${{ (needs.export-notarized-app.result == 'failure') || (needs.create-dmg.result == 'failure') }}

steps:
- name: Send Mattermost message
if: ${{ env.success || env.failure }} # Don't execute when cancelled
env:
ASANA_TASK_URL: ${{ github.event.inputs.asana-task-url || inputs.asana-task-url }}
GH_TOKEN: ${{ github.token }}
Expand All @@ -356,7 +361,12 @@ jobs:
export ASANA_LINK=" | [:asana: Asana task](${ASANA_TASK_URL})"
fi
if [[ "${{ env.success }}" == "true" ]]; then
status="success"
else
status="failure"
fi
curl -s -H 'Content-type: application/json' \
-d "$(envsubst < message-template.json)" \
-d "$(envsubst < message-template.json | jq ".${status}")" \
${{ secrets.MM_WEBHOOK_URL }}
fi
13 changes: 12 additions & 1 deletion .github/workflows/create_variants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,13 @@ jobs:

runs-on: ubuntu-latest

env:
success: ${{ needs.create-atb-variants.result == 'success' }}
failure: ${{ needs.create-atb-variants.result == 'failure' }}

steps:
- name: Send Mattermost message
if: ${{ env.success || env.failure }} # Don't execute when cancelled
env:
GH_TOKEN: ${{ github.token }}
WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
Expand All @@ -164,7 +169,13 @@ jobs:
if [[ -z "${MM_USER_HANDLE}" ]]; then
echo "Mattermost user handle not known for ${{ github.actor }}, skipping sending message"
else
if [[ "${{ env.success }}" == "true" ]]; then
status="success"
else
status="failure"
fi
curl -s -H 'Content-type: application/json' \
-d "$(envsubst < message-template.json)" \
-d "$(envsubst < message-template.json | jq ".${status}")" \
${{ secrets.MM_WEBHOOK_URL }}
fi
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13387,7 +13387,7 @@
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 108.0.0;
version = 108.1.0;
};
};
AA06B6B52672AF8100F541C5 /* XCRemoteSwiftPackageReference "Sparkle" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "39a0ed6853b823a33d85277ca3ee4385f81e4595",
"version" : "108.0.0"
"revision" : "ab03bde3e1817b267debe9858a08b3f0caf72dc3",
"version" : "108.1.0"
}
},
{
Expand Down
10 changes: 10 additions & 0 deletions DuckDuckGo/Common/Extensions/NSAlertExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@ extension NSAlert {
return alert
}

static func removeAllDBPStateAndDataAlert() -> NSAlert {
let alert = NSAlert()
alert.messageText = "Uninstall Personal Information Removal Login Item?"
alert.informativeText = "This will remove the Personal Information Removal Login Item, delete all your data and reset the waitlist state."
alert.alertStyle = .warning
alert.addButton(withTitle: "Uninstall")
alert.addButton(withTitle: UserText.cancel)
return alert
}

static func noAccessToDownloads() -> NSAlert {
let alert = NSAlert()
alert.messageText = UserText.noAccessToDownloadsFolderHeader
Expand Down
1 change: 1 addition & 0 deletions DuckDuckGo/Common/Utilities/UserDefaultsWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public struct UserDefaultsWrapper<T> {
case askToSaveAddresses = "preferences.ask-to-save.addresses"
case askToSavePaymentMethods = "preferences.ask-to-save.payment-methods"
case autolockLocksFormFilling = "preferences.lock-autofill-form-fill"
case autofillDebugScriptEnabled = "preferences.enable-autofill-debug-script"

case saveAsPreferredFileType = "saveAs.selected.filetype"

Expand Down
3 changes: 2 additions & 1 deletion DuckDuckGo/ContentBlocker/ScriptSourceProviding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ struct ScriptSourceProvider: ScriptSourceProviding {
return DefaultAutofillSourceProvider.Builder(privacyConfigurationManager: privacyConfigurationManager,
properties: ContentScopeProperties(gpcEnabled: privacySettings.gpcEnabled,
sessionKey: self.sessionKey ?? "",
featureToggles: ContentScopeFeatureToggles.supportedFeaturesOnMacOS(privacyConfig)))
featureToggles: ContentScopeFeatureToggles.supportedFeaturesOnMacOS(privacyConfig)),
isDebug: AutofillPreferences().debugScriptEnabled)
.withJSLoading()
.build()
}
Expand Down
10 changes: 10 additions & 0 deletions DuckDuckGo/DBP/DataBrokerProtectionDebugMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ final class DataBrokerProtectionDebugMenu: NSMenu {
.targetting(self)
NSMenuItem(title: "Run Personal Information Removal Debug Mode", action: #selector(DataBrokerProtectionDebugMenu.runCustomJSON))
.targetting(self)
NSMenuItem(title: "Reset All State and Delete All Data", action: #selector(DataBrokerProtectionDebugMenu.deleteAllDataAndStopAgent))
.targetting(self)
}
}

Expand Down Expand Up @@ -228,6 +230,14 @@ final class DataBrokerProtectionDebugMenu: NSMenu {
LoginItemsManager().enableLoginItems([LoginItem.dbpBackgroundAgent], log: .dbp)
}

@objc private func deleteAllDataAndStopAgent() {
Task { @MainActor in
guard case .alertFirstButtonReturn = await NSAlert.removeAllDBPStateAndDataAlert().runModal() else { return }
resetWaitlistState()
DataBrokerProtectionFeatureDisabler().disableAndDelete()
}
}

@objc private func showDatabaseBrowser() {
let viewController = DataBrokerDatabaseBrowserViewController()
let window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 500, height: 400),
Expand Down
15 changes: 15 additions & 0 deletions DuckDuckGo/Menus/MainMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ import SubscriptionUI
private var loggingMenu: NSMenu?
let customConfigurationUrlMenuItem = NSMenuItem(title: "Last Update Time", action: nil)
let configurationDateAndTimeMenuItem = NSMenuItem(title: "Configuration URL", action: nil)
let autofillDebugScriptMenuItem = NSMenuItem(title: "Autofill Debug Script", action: #selector(MainMenu.toggleAutofillScriptDebugSettingsAction))

// MARK: - Help

Expand Down Expand Up @@ -385,6 +386,7 @@ import SubscriptionUI
updateLoggingMenuItems()
updateInternalUserItem()
updateRemoteConfigurationInfo()
updateAutofillDebugScriptMenuItem()
}

// MARK: - Bookmarks
Expand Down Expand Up @@ -614,6 +616,9 @@ import SubscriptionUI
menu.addItem(menuItem)
}

menu.addItem(autofillDebugScriptMenuItem
.targetting(self))

menu.addItem(.separator())
let debugLoggingMenuItem = NSMenuItem(title: OSLog.isRunningInDebugEnvironment ? "Disable DEBUG level logging…" : "Enable DEBUG level logging…", action: #selector(debugLoggingMenuItemAction), target: self)
menu.addItem(debugLoggingMenuItem)
Expand Down Expand Up @@ -642,6 +647,10 @@ import SubscriptionUI
}
}

private func updateAutofillDebugScriptMenuItem() {
autofillDebugScriptMenuItem.state = AutofillPreferences().debugScriptEnabled ? .on : .off
}

private func updateRemoteConfigurationInfo() {
var dateString: String
if let date = ConfigurationManager.shared.lastConfigurationInstallDate {
Expand Down Expand Up @@ -672,6 +681,12 @@ import SubscriptionUI
OSLog.loggingCategories = []
}

@objc private func toggleAutofillScriptDebugSettingsAction(_ sender: NSMenuItem) {
AutofillPreferences().debugScriptEnabled = !AutofillPreferences().debugScriptEnabled
NotificationCenter.default.post(name: .autofillScriptDebugSettingsDidChange, object: nil)
updateAutofillDebugScriptMenuItem()
}

@objc private func debugLoggingMenuItemAction(_ sender: NSMenuItem) {
#if APPSTORE
if !OSLog.isRunningInDebugEnvironment {
Expand Down
17 changes: 17 additions & 0 deletions DuckDuckGo/Preferences/Model/AutofillPreferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ protocol AutofillPreferencesPersistor {
var askToSavePaymentMethods: Bool { get set }
var autolockLocksFormFilling: Bool { get set }
var passwordManager: PasswordManager { get set }
var debugScriptEnabled: Bool { get set }
}

enum PasswordManager: String, CaseIterable {
Expand Down Expand Up @@ -67,6 +68,7 @@ enum AutofillAutoLockThreshold: String, CaseIterable {
extension NSNotification.Name {
static let autofillAutoLockSettingsDidChange = NSNotification.Name("autofillAutoLockSettingsDidChange")
static let autofillUserSettingsDidChange = NSNotification.Name("autofillUserSettingsDidChange")
static let autofillScriptDebugSettingsDidChange = NSNotification.Name("autofillScriptDebugSettingsDidChange")
}

final class AutofillPreferences: AutofillPreferencesPersistor {
Expand Down Expand Up @@ -132,6 +134,21 @@ final class AutofillPreferences: AutofillPreferencesPersistor {
@UserDefaultsWrapper(key: .selectedPasswordManager, defaultValue: PasswordManager.duckduckgo.rawValue)
private var selectedPasswordManager: String

@UserDefaultsWrapper(key: .autofillDebugScriptEnabled, defaultValue: false)
private var debugScriptEnabledWrapped: Bool

var debugScriptEnabled: Bool {
get {
return debugScriptEnabledWrapped
}

set {
if debugScriptEnabledWrapped != newValue {
debugScriptEnabledWrapped = newValue
}
}
}

private var statisticsStore: StatisticsStore {
return injectedDependencyStore ?? defaultDependencyStore
}
Expand Down
1 change: 1 addition & 0 deletions DuckDuckGo/Tab/Model/UserContentUpdating.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ final class UserContentUpdating {
.combineLatest(privacySecurityPreferences.$gpcEnabled)
.map { $0.0 } // drop gpcEnabled value: $0.1
.combineLatest(onNotificationWithInitial(.autofillUserSettingsDidChange), combine)
.combineLatest(onNotificationWithInitial(.autofillScriptDebugSettingsDidChange), combine)
// DefaultScriptSourceProvider instance should be created once per rules/config change and fed into UserScripts initialization
.map(makeValue)
.assign(to: \.bufferedValue, onWeaklyHeld: self) // buffer latest update value
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/DataBrokerProtection/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let package = Package(
targets: ["DataBrokerProtection"])
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.1.0"),
.package(path: "../PixelKit"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../XPCHelper")
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/LoginItems/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.1.0"),
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/NetworkProtectionMac/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let package = Package(
.library(name: "NetworkProtectionUI", targets: ["NetworkProtectionUI"])
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.1.0"),
.package(path: "../XPCHelper"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../LoginItems")
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/PixelKit/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.1.0"),
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SubscriptionUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
targets: ["SubscriptionUI"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.1.0"),
.package(path: "../SwiftUIExtensions")
],
targets: [
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SwiftUIExtensions/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let package = Package(
.library(name: "PreferencesViews", targets: ["PreferencesViews"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.1.0"),
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SyncUI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let package = Package(
],
dependencies: [
.package(path: "../SwiftUIExtensions"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.1.0"),
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/SystemExtensionManager/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.1.0"),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/XPCHelper/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let package = Package(
.library(name: "XPCHelper", targets: ["XPCHelper"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.0.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "108.1.0"),
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion Submodules/privacy-reference-tests
1 change: 1 addition & 0 deletions UnitTests/Preferences/AutofillPreferencesModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ final class AutofillPreferencesPersistorMock: AutofillPreferencesPersistor {
var askToSavePaymentMethods: Bool = true
var passwordManager: PasswordManager = .duckduckgo
var autolockLocksFormFilling: Bool = false
var debugScriptEnabled: Bool = false
}

final class UserAuthenticatorMock: UserAuthenticating {
Expand Down
15 changes: 14 additions & 1 deletion scripts/assets/appstore-release-mm-template.json
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
{"channel":"${MM_USER_HANDLE}","username":"GitHub Actions","text":"**macOS app has been successfully uploaded to ${DESTINATION}** :goose_honk_tada: | [:github: Workflow run summary](${WORKFLOW_URL})","icon_url":"https://duckduckgo.com/assets/logo_header.v108.svg"}
{
"success": {
"channel": "${MM_USER_HANDLE}",
"username": "GitHub Actions",
"text": "**macOS app has been successfully uploaded to ${DESTINATION}** :goose_honk_tada: | [:github: Workflow run summary](${WORKFLOW_URL})",
"icon_url": "https://duckduckgo.com/assets/logo_header.v108.svg"
},
"failure": {
"channel": "${MM_USER_HANDLE}",
"username": "GitHub Actions",
"text": ":rotating_light: **macOS app ${DESTINATION} workflow failed** | [:github: Workflow run summary](${WORKFLOW_URL})",
"icon_url": "https://duckduckgo.com/assets/logo_header.v108.svg"
}
}
15 changes: 14 additions & 1 deletion scripts/assets/release-mm-template.json
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
{"channel":"${MM_USER_HANDLE}","username":"GitHub Actions","text":"**Notarized macOS app `${RELEASE_TYPE}` build is ready** :goose_honk_tada: | [:github: Workflow run summary](${WORKFLOW_URL})${ASANA_LINK}","icon_url":"https://duckduckgo.com/assets/logo_header.v108.svg"}
{
"success": {
"channel": "${MM_USER_HANDLE}",
"username": "GitHub Actions",
"text": "**Notarized macOS app `${RELEASE_TYPE}` build is ready** :goose_honk_tada: | [:github: Workflow run summary](${WORKFLOW_URL})${ASANA_LINK}",
"icon_url": "https://duckduckgo.com/assets/logo_header.v108.svg"
},
"failure": {
"channel": "${MM_USER_HANDLE}",
"username": "GitHub Actions",
"text": ":rotating_light: **Notarized macOS app `${RELEASE_TYPE}` build failed** | [:github: Workflow run summary](${WORKFLOW_URL})${ASANA_LINK}",
"icon_url": "https://duckduckgo.com/assets/logo_header.v108.svg"
}
}
15 changes: 14 additions & 1 deletion scripts/assets/variants-release-mm-template.json
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
{"channel":"${MM_USER_HANDLE}","username":"GitHub Actions","text":"**macOS app variants have been published successfully** :goose_honk_tada: | [:github: Workflow run summary](${WORKFLOW_URL})","icon_url":"https://duckduckgo.com/assets/logo_header.v108.svg"}
{
"success": {
"channel": "${MM_USER_HANDLE}",
"username": "GitHub Actions",
"text": "**macOS app variants have been published successfully** :goose_honk_tada: | [:github: Workflow run summary](${WORKFLOW_URL})",
"icon_url": "https://duckduckgo.com/assets/logo_header.v108.svg"
},
"failure": {
"channel": "${MM_USER_HANDLE}",
"username": "GitHub Actions",
"text": ":rotating_light: **macOS app variants workflow failed** | [:github: Workflow run summary](${WORKFLOW_URL})",
"icon_url": "https://duckduckgo.com/assets/logo_header.v108.svg"
}
}

0 comments on commit 543f5ba

Please sign in to comment.