Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBP remote messaging #1997

Merged
merged 35 commits into from
Jan 10, 2024
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
d479715
Refactor survey generation out into a shared class.
samsymons Dec 20, 2023
7ff55d3
Add a dedicated DBP remote message class.
samsymons Dec 20, 2023
3a66eb4
Make the remote messaging request class reusable.
samsymons Dec 20, 2023
13f710d
Make the remote message storage class generic.
samsymons Dec 20, 2023
64e64e4
Add placeholders for DBP remote messages in the new tab page.
samsymons Dec 20, 2023
2631c9f
Add a DBP remote messaging class.
samsymons Dec 20, 2023
635cce0
Get message fetching working.
samsymons Dec 20, 2023
d4f20f9
Add pixels.
samsymons Dec 21, 2023
e36e7ca
Remove unused file.
samsymons Dec 21, 2023
8c8448e
Merge branch 'main' into sam/data-broker-remote-messaging
samsymons Dec 22, 2023
dc62908
Tweak enum case name
samsymons Dec 22, 2023
f2bab30
Fix some comments.
samsymons Dec 22, 2023
b4538a8
Fix a compile error.
samsymons Dec 22, 2023
27c7f2e
Clean up query item building.
samsymons Dec 22, 2023
81d9183
Resolve unit test compilation, with one commented out test for now.
samsymons Dec 22, 2023
80abed0
Allow the survey cards to wrap to multiple lines.
samsymons Dec 23, 2023
fe3336d
Inject user defaults to WaitlistActivationDateStore
jotaemepereira Dec 22, 2023
07adda5
Create enum for waitlist activation data source
jotaemepereira Dec 23, 2023
4beadca
Use enum for keys
jotaemepereira Dec 23, 2023
5d1d6d1
Inject waitlist source
jotaemepereira Dec 23, 2023
9e8f88b
Inject dbp feature visibility
jotaemepereira Dec 23, 2023
4dfb0df
add active and last active dates for dbp
jotaemepereira Dec 23, 2023
8ca6e61
Pass source in the init params
jotaemepereira Dec 24, 2023
6646d37
Merge branch 'main' into sam/data-broker-remote-messaging
samsymons Jan 9, 2024
fc29912
Fix merge conflict issues.
samsymons Jan 9, 2024
c902fd9
Use the DBP waitlist activation store.
samsymons Jan 9, 2024
4fffb7b
Fix URL encoding.
samsymons Jan 9, 2024
af6a069
Fix unit tests.
samsymons Jan 9, 2024
a229f5e
Uncomment a disabled unit test.
samsymons Jan 9, 2024
d0ba303
Merge branch 'main' into sam/data-broker-remote-messaging
samsymons Jan 10, 2024
cd38ef6
Clean up constants.
samsymons Jan 10, 2024
512d15a
Fix compiler warnings.
samsymons Jan 10, 2024
915b60e
Remove print statement.
samsymons Jan 10, 2024
5c6723b
Fix compiler warning.
samsymons Jan 10, 2024
1cac5dd
Remove unnecessary newline.
samsymons Jan 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix URL encoding.
samsymons committed Jan 9, 2024
commit 4fffb7b883fb623bdb582bd4f37d2b28479d9992
3 changes: 2 additions & 1 deletion DuckDuckGo/Common/Surveys/SurveyURLBuilder.swift
Original file line number Diff line number Diff line change
@@ -96,7 +96,8 @@ final class SurveyURLBuilder {
}

private func queryItem(parameter: SurveyURLParameters, value: String) -> URLQueryItem {
let sanitizedValue = value.addingPercentEncoding(withAllowedCharacters: .alphanumerics)
let urlAllowed: CharacterSet = .alphanumerics.union(.init(charactersIn: "-._~"))
let sanitizedValue = value.addingPercentEncoding(withAllowedCharacters: urlAllowed)
return URLQueryItem(name: parameter.rawValue, value: sanitizedValue)
}

3 changes: 2 additions & 1 deletion DuckDuckGo/VPNFeedbackForm/VPNFeedbackSender.swift
Original file line number Diff line number Diff line change
@@ -27,7 +27,8 @@ protocol VPNFeedbackSender {
struct DefaultVPNFeedbackSender: VPNFeedbackSender {

func send(metadata: VPNMetadata, category: VPNFeedbackCategory, userText: String) async throws {
let encodedUserText = userText.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? userText
let urlAllowed: CharacterSet = .alphanumerics.union(.init(charactersIn: "-._~"))
let encodedUserText = userText.addingPercentEncoding(withAllowedCharacters: urlAllowed) ?? userText
let pixelEvent = Pixel.Event.vpnBreakageReport(category: category.rawValue, description: encodedUserText, metadata: metadata.toBase64())

try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<Void, Error>) in

Unchanged files with check annotations Beta

operationQueue.addOperation(collection)
}
operationQueue.addBarrierBlock { [weak self] in

Check warning on line 125 in LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift

GitHub Actions / Make Release Build (DuckDuckGo Privacy Browser)

variable 'self' was written to, but never read

Check warning on line 125 in LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift

GitHub Actions / Make Release Build (DuckDuckGo Privacy Browser)

variable 'self' was written to, but never read

Check warning on line 125 in LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift

GitHub Actions / Make Release Build (DuckDuckGo Privacy Pro)

variable 'self' was written to, but never read

Check warning on line 125 in LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift

GitHub Actions / Make Release Build (DuckDuckGo Privacy Pro)

variable 'self' was written to, but never read

Check warning on line 125 in LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionProcessor.swift

GitHub Actions / Test (Non-Sandbox)

variable 'self' was written to, but never read
completion()
}
}
return url
}
guard let actionType = action.actionType, actionType == .openSurveyURL, let surveyURL = action.actionURL else {

Check warning on line 56 in DuckDuckGo/DBP/RemoteMessaging/DataBrokerProtectionRemoteMessage.swift

GitHub Actions / Make Release Build (DuckDuckGo Privacy Browser)

immutable value 'surveyURL' was never used; consider replacing with '_' or removing it

Check warning on line 56 in DuckDuckGo/DBP/RemoteMessaging/DataBrokerProtectionRemoteMessage.swift

GitHub Actions / Make Release Build (DuckDuckGo Privacy Pro)

immutable value 'surveyURL' was never used; consider replacing with '_' or removing it

Check warning on line 56 in DuckDuckGo/DBP/RemoteMessaging/DataBrokerProtectionRemoteMessage.swift

GitHub Actions / Test (Non-Sandbox)

immutable value 'surveyURL' was never used; consider replacing with '_' or removing it

Check warning on line 56 in DuckDuckGo/DBP/RemoteMessaging/DataBrokerProtectionRemoteMessage.swift

GitHub Actions / Test (Sandbox)

immutable value 'surveyURL' was never used; consider replacing with '_' or removing it

Check warning on line 56 in DuckDuckGo/DBP/RemoteMessaging/DataBrokerProtectionRemoteMessage.swift

GitHub Actions / Test (Sandbox)

immutable value 'surveyURL' was never used; consider replacing with '_' or removing it
return nil
}
// if you want to refactor this to remove the warning - stop now
// the suggested method with NSWorkspace.OpenConfiguration doesn‘t work for Sharing Preferences
NSWorkspace.shared.open([url],

Check warning on line 76 in DuckDuckGo/Sharing/SharingMenu.swift

GitHub Actions / Make Release Build (DuckDuckGo Privacy Browser)

'open(_:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:)' was deprecated in macOS 11.0: Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead.

Check warning on line 76 in DuckDuckGo/Sharing/SharingMenu.swift

GitHub Actions / Make Release Build (DuckDuckGo Privacy Pro)

'open(_:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:)' was deprecated in macOS 11.0: Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead.

Check warning on line 76 in DuckDuckGo/Sharing/SharingMenu.swift

GitHub Actions / Test (Non-Sandbox)

'open(_:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:)' was deprecated in macOS 11.0: Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead.

Check warning on line 76 in DuckDuckGo/Sharing/SharingMenu.swift

GitHub Actions / Test (Sandbox)

'open(_:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:)' was deprecated in macOS 11.0: Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead.
withAppBundleIdentifier: nil,
options: .async,

Check warning on line 78 in DuckDuckGo/Sharing/SharingMenu.swift

GitHub Actions / Make Release Build (DuckDuckGo Privacy Browser)

'async' was deprecated in macOS 11.0: When using NSWorkspaceOpenConfiguration, all launches are asynchronous.

Check warning on line 78 in DuckDuckGo/Sharing/SharingMenu.swift

GitHub Actions / Make Release Build (DuckDuckGo Privacy Pro)

'async' was deprecated in macOS 11.0: When using NSWorkspaceOpenConfiguration, all launches are asynchronous.

Check warning on line 78 in DuckDuckGo/Sharing/SharingMenu.swift

GitHub Actions / Test (Non-Sandbox)

'async' was deprecated in macOS 11.0: When using NSWorkspaceOpenConfiguration, all launches are asynchronous.

Check warning on line 78 in DuckDuckGo/Sharing/SharingMenu.swift

GitHub Actions / Test (Sandbox)

'async' was deprecated in macOS 11.0: When using NSWorkspaceOpenConfiguration, all launches are asynchronous.
additionalEventParamDescriptor: descriptor,
launchIdentifiers: nil)
}
var points = [CGPoint](repeating: .zero, count: 3)
for i in 0 ..< self.elementCount {
let type = self.element(at: i, associatedPoints: &points)
switch type {

Check warning on line 30 in DuckDuckGo/Common/Extensions/NSBezierPathExtension.swift

GitHub Actions / Make Release Build (DuckDuckGo Privacy Browser)

switch must be exhaustive

Check warning on line 30 in DuckDuckGo/Common/Extensions/NSBezierPathExtension.swift

GitHub Actions / Make Release Build (DuckDuckGo Privacy Pro)

switch must be exhaustive

Check warning on line 30 in DuckDuckGo/Common/Extensions/NSBezierPathExtension.swift

GitHub Actions / Test (Non-Sandbox)

switch must be exhaustive

Check warning on line 30 in DuckDuckGo/Common/Extensions/NSBezierPathExtension.swift

GitHub Actions / Test (Sandbox)

switch must be exhaustive
case .moveTo:
path.move(to: points[0])
case .lineTo:
return NSImage(named: "Survey-128")!.resized(to: iconSize)!
case .networkProtectionRemoteMessage:
return NSImage(named: "VPN-Ended")!.resized(to: iconSize)!
case .dataBrokerProtectionRemoteMessage(let message):

Check warning on line 600 in DuckDuckGo/HomePage/Model/HomePageContinueSetUpModel.swift

GitHub Actions / Make Release Build (DuckDuckGo Privacy Browser)

immutable value 'message' was never used; consider replacing with '_' or removing it

Check warning on line 600 in DuckDuckGo/HomePage/Model/HomePageContinueSetUpModel.swift

GitHub Actions / Test (Non-Sandbox)

immutable value 'message' was never used; consider replacing with '_' or removing it

Check warning on line 600 in DuckDuckGo/HomePage/Model/HomePageContinueSetUpModel.swift

GitHub Actions / Test (Sandbox)

immutable value 'message' was never used; consider replacing with '_' or removing it
return NSImage(named: "DBP-Information-Remover")!.resized(to: iconSize)!
case .dataBrokerProtectionWaitlistInvited:
return NSImage(named: "DBP-Information-Remover")!.resized(to: iconSize)!
return url
}
guard let actionType = action.actionType, actionType == .openSurveyURL, let surveyURL = action.actionURL else {

Check warning on line 56 in DuckDuckGo/NetworkProtection/AppTargets/DeveloperIDTarget/NetworkProtectionRemoteMessaging/NetworkProtectionRemoteMessage.swift

GitHub Actions / Make Release Build (DuckDuckGo Privacy Pro)

immutable value 'surveyURL' was never used; consider replacing with '_' or removing it

Check warning on line 56 in DuckDuckGo/NetworkProtection/AppTargets/DeveloperIDTarget/NetworkProtectionRemoteMessaging/NetworkProtectionRemoteMessage.swift

GitHub Actions / Test (Non-Sandbox)

immutable value 'surveyURL' was never used; consider replacing with '_' or removing it

Check warning on line 56 in DuckDuckGo/NetworkProtection/AppTargets/DeveloperIDTarget/NetworkProtectionRemoteMessaging/NetworkProtectionRemoteMessage.swift

GitHub Actions / Test (Sandbox)

immutable value 'surveyURL' was never used; consider replacing with '_' or removing it

Check warning on line 56 in DuckDuckGo/NetworkProtection/AppTargets/DeveloperIDTarget/NetworkProtectionRemoteMessaging/NetworkProtectionRemoteMessage.swift

GitHub Actions / Test (Sandbox)

immutable value 'surveyURL' was never used; consider replacing with '_' or removing it
return nil
}
struct Sidebar: View {
@EnvironmentObject var model: PreferencesSidebarModel
var body: some View {

Check warning on line 70 in DuckDuckGo/Preferences/View/PreferencesSidebar.swift

GitHub Actions / Test (Sandbox)

getter 'body' took 362ms to type-check (limit: 250ms)

Check warning on line 70 in DuckDuckGo/Preferences/View/PreferencesSidebar.swift

GitHub Actions / Test (Sandbox)

getter 'body' took 316ms to type-check (limit: 250ms)
VStack(spacing: 12) {
TabSwitcher()
.environmentObject(model)