-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dominik/xcode-16
- Loading branch information
Showing
309 changed files
with
14,226 additions
and
763,564 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Update Phishing Detection Datasets | ||
on: | ||
schedule: | ||
- cron: '0 0 * * 0' # Midnight UTC every Sunday | ||
jobs: | ||
update_data: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: duckduckgo/macos-browser | ||
path: macos/ | ||
token: ${{ secrets.DAX_MACOS_BROWSER_PHISHING_AUTOMATION }} | ||
- name: Execute Update Script | ||
run: | | ||
cd ./macos | ||
REVISION="$(bash ./scripts/update_phishing_detection_data.sh | grep -oP 'Updated revision from \K\d+')" | ||
echo "REVISION=$REVISION" >> $GITHUB_ENV | ||
TEMPLATE="$(bash ./scripts/update_phishing_detection_data.sh pr-body)" | ||
PR_BODY_MACOS="${TEMPLATE//\{\{revision\}\}/$REVISION}" | ||
echo "PR_BODY_MACOS<<EOF" >> $GITHUB_ENV | ||
echo "$PR_BODY_MACOS" >> $GITHUB_ENV | ||
echo "EOF" >> $GITHUB_ENV | ||
- name: Create PR for macOS | ||
uses: peter-evans/create-pull-request@88bf0de51c7487d91e1abbb4899332e602c58bbf | ||
id: create-pr | ||
with: | ||
path: macos/ | ||
add-paths: | | ||
./DuckDuckGo/PhishingDetection/ | ||
commit-message: Update phishing detection data to revision ${{ env.REVISION }} | ||
branch: update-phishing-protection-${{ env.REVISION }} | ||
title: Update phishing protection datasets to ${{ env.REVISION }} | ||
body: "${{ env.PR_BODY_MACOS }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
CURRENT_PROJECT_VERSION = 286 | ||
CURRENT_PROJECT_VERSION = 293 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
MARKETING_VERSION = 1.111.0 | ||
MARKETING_VERSION = 1.112.0 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// | ||
// AIChatPreferencesStorage.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. | ||
// | ||
|
||
import Combine | ||
|
||
protocol AIChatPreferencesStorage { | ||
var showShortcutInApplicationMenu: Bool { get set } | ||
var shouldDisplayToolbarShortcut: Bool { get set } | ||
|
||
var showShortcutInApplicationMenuPublisher: AnyPublisher<Bool, Never> { get } | ||
var shouldDisplayToolbarShortcutPublisher: AnyPublisher<Bool, Never> { get } | ||
} | ||
|
||
struct DefaultAIChatPreferencesStorage: AIChatPreferencesStorage { | ||
var showShortcutInApplicationMenuPublisher: AnyPublisher<Bool, Never> { | ||
userDefaults.showAIChatShortcutInApplicationMenuPublisher | ||
} | ||
|
||
var shouldDisplayToolbarShortcutPublisher: AnyPublisher<Bool, Never> { | ||
NotificationCenter.default.publisher(for: .PinnedViewsChanged) | ||
.compactMap { notification -> PinnableView? in | ||
guard let userInfo = notification.userInfo as? [String: Any], | ||
let viewType = userInfo[LocalPinningManager.pinnedViewChangedNotificationViewTypeKey] as? String, | ||
let view = PinnableView(rawValue: viewType) else { | ||
return nil | ||
} | ||
return view == .aiChat ? view : nil | ||
} | ||
.flatMap { view -> AnyPublisher<Bool, Never> in | ||
return Just(self.pinningManager.isPinned(view)).eraseToAnyPublisher() | ||
} | ||
.eraseToAnyPublisher() | ||
} | ||
|
||
private let userDefaults: UserDefaults | ||
private let pinningManager: PinningManager | ||
|
||
init(userDefaults: UserDefaults = .standard, | ||
pinningManager: PinningManager = LocalPinningManager.shared) { | ||
self.userDefaults = userDefaults | ||
self.pinningManager = pinningManager | ||
} | ||
|
||
var shouldDisplayToolbarShortcut: Bool { | ||
get { pinningManager.isPinned(.aiChat) } | ||
set { | ||
if newValue { | ||
pinningManager.pin(.aiChat) | ||
} else { | ||
pinningManager.unpin(.aiChat) | ||
} | ||
} | ||
} | ||
|
||
var showShortcutInApplicationMenu: Bool { | ||
get { userDefaults.showAIChatShortcutInApplicationMenu } | ||
set { userDefaults.showAIChatShortcutInApplicationMenu = newValue } | ||
} | ||
} | ||
|
||
private extension UserDefaults { | ||
private var showAIChatShortcutInApplicationMenuKey: String { | ||
"aichat.showAIChatShortcutInApplicationMenu" | ||
} | ||
|
||
static let showAIChatShortcutInApplicationMenuDefaultValue = false | ||
|
||
@objc | ||
dynamic var showAIChatShortcutInApplicationMenu: Bool { | ||
get { | ||
value(forKey: showAIChatShortcutInApplicationMenuKey) as? Bool ?? Self.showAIChatShortcutInApplicationMenuDefaultValue | ||
} | ||
|
||
set { | ||
guard newValue != showAIChatShortcutInApplicationMenu else { | ||
return | ||
} | ||
|
||
set(newValue, forKey: showAIChatShortcutInApplicationMenuKey) | ||
} | ||
} | ||
|
||
var showAIChatShortcutInApplicationMenuPublisher: AnyPublisher<Bool, Never> { | ||
publisher(for: \.showAIChatShortcutInApplicationMenu).eraseToAnyPublisher() | ||
} | ||
} |
Oops, something went wrong.