Skip to content

Commit

Permalink
Merge branch 'alex/malware-protection-pixels' into alex/malware-prote…
Browse files Browse the repository at this point in the history
…ction-localization
  • Loading branch information
mallexxx committed Dec 20, 2024
2 parents 9c171b1 + 57e13df commit fb94523
Show file tree
Hide file tree
Showing 22 changed files with 270 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .xcode-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.1
16.2
2 changes: 1 addition & 1 deletion Configuration/BuildNumber.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 330
CURRENT_PROJECT_VERSION = 332
18 changes: 16 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,9 @@
37FC2A192CF903080048E226 /* MockPrivacyStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37FC2A172CF903060048E226 /* MockPrivacyStats.swift */; };
37FD78112A29EBD100B36DB1 /* SyncErrorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37FD78102A29EBD100B36DB1 /* SyncErrorHandler.swift */; };
37FD78122A29EBD100B36DB1 /* SyncErrorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37FD78102A29EBD100B36DB1 /* SyncErrorHandler.swift */; };
46066CBC2D1330A100AB683B /* Persistence in Frameworks */ = {isa = PBXBuildFile; productRef = 46066CBB2D1330A100AB683B /* Persistence */; };
467D16672D0C98D5007C020A /* CrashReportSenderExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 467D16662D0C98D5007C020A /* CrashReportSenderExtensions.swift */; };
467D16682D0C98D5007C020A /* CrashReportSenderExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 467D16662D0C98D5007C020A /* CrashReportSenderExtensions.swift */; };
4B0135CE2729F1AA00D54834 /* NSPasteboardExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B0135CD2729F1AA00D54834 /* NSPasteboardExtension.swift */; };
4B02198925E05FAC00ED7DEA /* FireproofingURLExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B02197F25E05FAC00ED7DEA /* FireproofingURLExtensions.swift */; };
4B02198A25E05FAC00ED7DEA /* FireproofDomains.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B02198125E05FAC00ED7DEA /* FireproofDomains.swift */; };
Expand Down Expand Up @@ -3796,6 +3799,7 @@
37F8ABD22CE3EE5B00CB0294 /* FeatureFlagOverridesMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureFlagOverridesMenu.swift; sourceTree = "<group>"; };
37FC2A172CF903060048E226 /* MockPrivacyStats.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockPrivacyStats.swift; sourceTree = "<group>"; };
37FD78102A29EBD100B36DB1 /* SyncErrorHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SyncErrorHandler.swift; sourceTree = "<group>"; };
467D16662D0C98D5007C020A /* CrashReportSenderExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrashReportSenderExtensions.swift; sourceTree = "<group>"; };
4B0135CD2729F1AA00D54834 /* NSPasteboardExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSPasteboardExtension.swift; sourceTree = "<group>"; };
4B02197F25E05FAC00ED7DEA /* FireproofingURLExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FireproofingURLExtensions.swift; sourceTree = "<group>"; };
4B02198125E05FAC00ED7DEA /* FireproofDomains.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FireproofDomains.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5345,6 +5349,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
46066CBC2D1330A100AB683B /* Persistence in Frameworks */,
B6DA44172616C13800DD1EC2 /* OHHTTPStubs in Frameworks */,
F116A7C32BD1924B00F3FCF7 /* PixelKitTestingUtilities in Frameworks */,
84BBC8012CFA0D3800BAE57A /* TestUtils in Frameworks */,
Expand Down Expand Up @@ -8639,6 +8644,7 @@
AAC30A27268E045400D2D9CD /* CrashReportReader.swift */,
AAC30A2D268F1EE300D2D9CD /* CrashReportPromptPresenter.swift */,
AAC30A29268E239100D2D9CD /* CrashReport.swift */,
467D16662D0C98D5007C020A /* CrashReportSenderExtensions.swift */,
);
path = Model;
sourceTree = "<group>";
Expand Down Expand Up @@ -10497,6 +10503,7 @@
9DC5FACA2C6B8E050011F068 /* AppKitExtensions */,
84BBC8002CFA0D3800BAE57A /* TestUtils */,
374EFDEE2D01C70300B30939 /* Utilities */,
46066CBB2D1330A100AB683B /* Persistence */,
);
productName = DuckDuckGoTests;
productReference = AA585D90248FD31400E9A3E2 /* Unit Tests.xctest */;
Expand Down Expand Up @@ -11571,6 +11578,7 @@
37197EA82942443D00394917 /* BrowserTabViewController.swift in Sources */,
3706FB39293F65D500E42796 /* PrivacyDashboardPopover.swift in Sources */,
3706FB3B293F65D500E42796 /* RootView.swift in Sources */,
467D16672D0C98D5007C020A /* CrashReportSenderExtensions.swift in Sources */,
3706FB3C293F65D500E42796 /* AddressBarTextField.swift in Sources */,
3706FB3D293F65D500E42796 /* FocusRingView.swift in Sources */,
3706FB3E293F65D500E42796 /* BookmarksBarViewModel.swift in Sources */,
Expand Down Expand Up @@ -13085,6 +13093,7 @@
AABEE6A524AA0A7F0043105B /* SuggestionViewController.swift in Sources */,
1D6216B229069BBF00386B2C /* BWKeyStorage.swift in Sources */,
AA7E919F287872EA00AB6B62 /* VisitViewModel.swift in Sources */,
467D16682D0C98D5007C020A /* CrashReportSenderExtensions.swift in Sources */,
7BD7B0012C19D3830039D20A /* VPNIPCResources.swift in Sources */,
C1935A1B2C88F9ED001AD72D /* SyncPromoViewModel.swift in Sources */,
B6676BE12AA986A700525A21 /* AddressBarTextEditor.swift in Sources */,
Expand Down Expand Up @@ -15296,8 +15305,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
branch = "alex/malware-protection-pixels";
kind = branch;
kind = exactVersion;
version = 223.0.0;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down Expand Up @@ -15700,6 +15709,11 @@
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = Navigation;
};
46066CBB2D1330A100AB683B /* Persistence */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
productName = Persistence;
};
4B2D062B2A11C0E100DE1F49 /* Networking */ = {
isa = XCSwiftPackageProductDependency;
package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */;
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" : {
"branch" : "alex/malware-protection-pixels",
"revision" : "6ebb657ff44df3ce17bcb93b3103946db470f52b"
"revision" : "e8f94cf597f4a447f86f39f461b736ac9ea280ce",
"version" : "223.0.0"
}
},
{
Expand Down
3 changes: 2 additions & 1 deletion DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
let fileStore: FileStore

#if APPSTORE
private let crashCollection = CrashCollection(platform: .macOSAppStore)
private let crashCollection = CrashCollection(crashReportSender: CrashReportSender(platform: .macOSAppStore,
pixelEvents: CrashReportSender.pixelEvents))
#else
private let crashReporter = CrashReporter()
#endif
Expand Down
43 changes: 43 additions & 0 deletions DuckDuckGo/CrashReports/Model/CrashReportSenderExtensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// CrashReportSenderExtensions.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 Crashes
import Common
import PixelKit

extension CrashReportSender {

static let pixelEvents: EventMapping<CrashReportSenderError> = .init { event, _, _, _ in
switch event {
case CrashReportSenderError.crcidMissing:
PixelKit.fire(GeneralPixel.crashReportCRCIDMissing)

case CrashReportSenderError.submissionFailed(let error):
if let error {
PixelKit.fire(DebugEvent(GeneralPixel.crashReportingSubmissionFailed),
frequency: .standard,
withHeaders: [:],
withAdditionalParameters: ["HTTPStatusCode": "\(error.statusCode)"],
withError: nil,
allowedQueryReservedCharacters: nil)
} else {
PixelKit.fire(GeneralPixel.crashReportingSubmissionFailed)
}
}
}
}
7 changes: 5 additions & 2 deletions DuckDuckGo/CrashReports/Model/CrashReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import PixelKit
final class CrashReporter {

private let reader = CrashReportReader()
private lazy var sender = CrashReportSender(platform: .macOS)
private lazy var sender = CrashReportSender(platform: .macOS, pixelEvents: CrashReportSender.pixelEvents)
private lazy var crcidManager = CRCIDManager()
private lazy var promptPresenter = CrashReportPromptPresenter()

@UserDefaultsWrapper(key: .lastCrashReportCheckDate, defaultValue: nil)
Expand Down Expand Up @@ -56,7 +57,9 @@ final class CrashReporter {
return
}
Task {
await self.sender.send(contentData)
let crcid = self.crcidManager.crcid
let result = await self.sender.send(contentData, crcid: crcid)
self.crcidManager.handleCrashSenderResult(result: result.result, response: result.response)
}
}

Expand Down
40 changes: 28 additions & 12 deletions DuckDuckGo/DataImport/View/FileImportView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -275,18 +275,34 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
button(UserText.importBookmarksSelectHTMLFile)

case (.safari, .passwords), (.safariTechnologyPreview, .passwords):
NSLocalizedString("import.csv.instructions.safari", value: """
%d Open **Safari**
%d Select **File → Export → Passwords**
%d Save the passwords file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Passwords as CSV from Safari.
%N$d - step number
%5$@ - “Select Passwords CSV File” button
**bold text**; _italic text_
""")
button(UserText.importLoginsSelectCSVFile)
if #available(macOS 15.2, *) {
NSLocalizedString("import.csv.instructions.safari.macos15-2", value: """
%d Open **Safari**
%d Open the **File menu → Export Browsing Data to File...**
%d Select **passwords** and save the file someplace you can find it (e.g., Desktop)
%d Double click the .zip file to unzip it
%d %@
""", comment: """
Instructions to import Passwords as CSV from Safari zip file on >= macOS 15.2.
%N$d - step number
%5$@ - “Select Passwords CSV File” button
**bold text**; _italic text_
""")
button(UserText.importLoginsSelectCSVFile)
} else {
NSLocalizedString("import.csv.instructions.safari", value: """
%d Open **Safari**
%d Select **File → Export → Passwords**
%d Save the passwords file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Passwords as CSV from Safari.
%N$d - step number
%5$@ - “Select Passwords CSV File” button
**bold text**; _italic text_
""")
button(UserText.importLoginsSelectCSVFile)
}

case (.safari, .bookmarks), (.safariTechnologyPreview, .bookmarks):
NSLocalizedString("import.html.instructions.safari", value: """
Expand Down
72 changes: 66 additions & 6 deletions DuckDuckGo/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -30931,6 +30931,66 @@
}
}
},
"import.csv.instructions.safari.macos15-2" : {
"comment" : "Instructions to import Passwords as CSV from Safari zip file on >= macOS 15.2.\n%N$d - step number\n%5$@ - “Select Passwords CSV File” button\n**bold text**; _italic text_",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "%1$d Öffne **Safari**\n%2$d Öffne das Menü **Datei → Browserdaten in Datei exportieren ...**\n%3$d Wähle **Passwörter** und speichere die Datei an einem Ort, an dem du sie wiederfindest (z. B. Desktop)\n%4$d Doppelklicke auf die .zip-Datei, um sie zu entpacken\n%5$d %6$@"
}
},
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "%1$d Open **Safari**\n%2$d Open the **File menu → Export Browsing Data to File...**\n%3$d Select **passwords** and save the file someplace you can find it (e.g., Desktop)\n%4$d Double click the .zip file to unzip it\n%5$d %6$@"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "%1$d Abre **Safari**\n%2$d Abre el menú **Archivo → Exportar datos de navegación a archivo...**\n%3$d Selecciona **contraseñas** y guarda el archivo en algún lugar donde puedas encontrarlo (por ejemplo, en el escritorio)\n%4$d Haz doble clic en el archivo .zip para descomprimirlo\n%5$d %6$@"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "%1$d Ouvrez **Safari**\n%2$d Ouvrez le **menu Fichier → Exporter les données de navigation vers le fichier…**\n%3$d Sélectionnez **mots de passe** et enregistrez le fichier à un endroit où le trouver facilement (par exemple, sur le bureau)\n%4$d Double-cliquez sur le fichier .zip pour le décompresser\n%5$d %6$@"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "%1$d Apri **Safari**\n%2$d Apri il menu **File → Esporta i dati di navigazione in un file...**\n%3$d Seleziona **password** e salva il file in una posizione che ti consenta di trovarlo (ad esempio, sul desktop)\n%4$d Fai doppio clic sul file .zip per decomprimerlo\n%5$d %6$@"
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "%1$d Open **Safari**\n%2$d Open het menu **Bestand → Browsergegevens exporteren naar bestand...**\n%3$d Selecteer **wachtwoorden** en sla het bestand op een plek op waar je het kunt vinden (bijv. je bureaublad)\n%4$d Dubbelklik op het .zip-bestand om het uit te pakken\n%5$d %6$@"
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
"value" : "%1$d Otwórz **Safari**\n%2$d Otwórz menu **Plik → Eksportuj dane przeglądania do pliku...**\n%3$d Wybierz **hasła** i zapisz plik w łatwo dostępnym miejscu (np. na biurku)\n%4$d Kliknij dwukrotnie plik .zip w celu jego rozpakowania\n%5$d %6$@"
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
"value" : "%1$d Abre o **Safari**\n%2$d Abre o menu **Ficheiro → Exportar dados de navegação para ficheiro...**\n%3$d Seleciona **palavras-passe** e guarda o ficheiro num local onde o possas encontrar (por exemplo, no ambiente de trabalho)\n%4$d Clica duas vezes no ficheiro .zip para o descomprimir\n%5$d %6$@"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "%1$d Запустите **Safari**\n%2$d Откройте меню **Файл → Экспортировать данные просмотров в файл...**\n%3$d Выберите **пароли** и сохраните файл там, где вы легко его найдете (например, на рабочем столе)\n%4$d Дважды нажмите мышью файл .zip, чтобы распаковать его\n%5$d %6$@"
}
}
}
},
"import.csv.instructions.vivaldi" : {
"comment" : "Instructions to import Passwords exported as CSV from Vivaldi browser.\n%N$d - step number\n%2$s - browser name (Vivaldi)\n%5$@ - menu button icon\n%8$@ - “Select Passwords CSV File” button\n**bold text**; _italic text_",
"extractionState" : "extracted_with_value",
Expand Down Expand Up @@ -36833,18 +36893,18 @@
"comment" : "Title shown in an error page tab that warn users of security risks on a website that has been flagged as Malware.",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Warning: Site May Be Malicious"
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Warnung: Website ist möglicherweise bösartig"
}
},
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Warning: Site May Be Malicious"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,12 @@
"value" : "Reconnect"
}
},
"en-US" : {
"stringUnit" : {
"state" : "translated",
"value" : "Reconnect"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
Expand Down
8 changes: 8 additions & 0 deletions DuckDuckGo/Statistics/GeneralPixel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ enum GeneralPixel: PixelKitEventV2 {

case crash
case crashOnCrashHandlersSetUp
case crashReportingSubmissionFailed
case crashReportCRCIDMissing
case compileRulesWait(onboardingShown: OnboardingShown, waitTime: CompileRulesWaitTime, result: WaitResult)
case launchInitial(cohort: String)
case launch(isDefault: Bool)
Expand Down Expand Up @@ -473,6 +475,12 @@ enum GeneralPixel: PixelKitEventV2 {
case .crashOnCrashHandlersSetUp:
return "m_mac_crash_on_handlers_setup"

case .crashReportCRCIDMissing:
return "m_mac_crashreporting_crcid-missing"

case .crashReportingSubmissionFailed:
return "m_mac_crashreporting_submission-failed"

case .compileRulesWait(onboardingShown: let onboardingShown, waitTime: let waitTime, result: let result):
return "m_mac_cbr-wait_\(onboardingShown)_\(waitTime)_\(result)"

Expand Down
6 changes: 6 additions & 0 deletions DuckDuckGoVPN/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,12 @@
"value" : "DuckDuckGo VPN"
}
},
"en-US" : {
"stringUnit" : {
"state" : "translated",
"value" : "DuckDuckGo VPN"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
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: "221.3.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "223.0.0"),
.package(path: "../SwiftUIExtensions"),
.package(path: "../AppKitExtensions"),
.package(path: "../XPCHelper"),
Expand Down
2 changes: 1 addition & 1 deletion LocalPackages/FeatureFlags/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
targets: ["FeatureFlags"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "221.3.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "223.0.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/NetworkProtectionMac/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ let package = Package(
.library(name: "VPNAppLauncher", targets: ["VPNAppLauncher"]),
],
dependencies: [
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "221.3.0"),
.package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "223.0.0"),
.package(url: "https://github.com/airbnb/lottie-spm", exact: "4.4.3"),
.package(path: "../AppLauncher"),
.package(path: "../UDSHelper"),
Expand Down
Loading

0 comments on commit fb94523

Please sign in to comment.