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

Reorganise PIR #3801

Merged
merged 23 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
28b5b5e
Remove unused assets
THISISDINOSAUR Jan 29, 2025
7566e38
Move HTTPUtils
THISISDINOSAUR Jan 29, 2025
c4e7593
Rename Services folder
THISISDINOSAUR Jan 29, 2025
cb70fb3
Rename Configuration folder
THISISDINOSAUR Jan 29, 2025
1cf0a75
Rename DebugUI folder
THISISDINOSAUR Jan 29, 2025
ab25308
Split UI folder into native and web
THISISDINOSAUR Jan 29, 2025
2841a79
Consolidate Storage and Database folders
THISISDINOSAUR Jan 29, 2025
237cfb2
Move DataManager to its own folder
THISISDINOSAUR Jan 29, 2025
d426cbf
Move broker managing to its own folder
THISISDINOSAUR Jan 29, 2025
e5ca755
Add separate view models folder
THISISDINOSAUR Jan 29, 2025
2510edf
Move view models to live with their views
THISISDINOSAUR Jan 29, 2025
b3a2efc
Move browser window manager to debug folder
THISISDINOSAUR Jan 29, 2025
8b128e9
Move background agent classes to new background agent folder
THISISDINOSAUR Jan 29, 2025
d21248f
Move and rename mocks
THISISDINOSAUR Jan 29, 2025
2960a06
Rename Scheduler to OperationQueueManaging
THISISDINOSAUR Jan 29, 2025
0a3283c
Break out utils into shared and macOS
THISISDINOSAUR Jan 29, 2025
2c34261
Remove unused invite code logic
THISISDINOSAUR Jan 29, 2025
9c0ddaf
Remove invite code things from tests
THISISDINOSAUR Jan 29, 2025
9390563
Move things into "Shared" and "MacOS" folders
THISISDINOSAUR Jan 29, 2025
cb43af4
Uncomment out statusbarpopoverview lines
THISISDINOSAUR Jan 29, 2025
320a6de
Fix DBPPrivacyConfigurationMocks header
THISISDINOSAUR Jan 29, 2025
81947e5
Fix swiftUI errors
THISISDINOSAUR Jan 31, 2025
30a5147
Merge branch 'main' into elle/reorganise-PIR
THISISDINOSAUR Jan 31, 2025
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
12 changes: 0 additions & 12 deletions DuckDuckGo/DBP/DBPHomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,6 @@ final class DBPHomeViewController: NSViewController {
}
}

extension DBPHomeViewController: DataBrokerProtectionInviteDialogsViewModelDelegate {
func dataBrokerProtectionInviteDialogsViewModelDidReedemSuccessfully(_ viewModel: DataBrokerProtectionInviteDialogsViewModel) {
presentedWindowController?.window?.close()
presentedWindowController = nil
setupUIWithCurrentStatus()
}

func dataBrokerProtectionInviteDialogsViewModelDidCancel(_ viewModel: DataBrokerProtectionInviteDialogsViewModel) {
closeUI()
}
}

// MARK: - Error UI

extension DBPHomeViewController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ import Subscription

final public class DataBrokerAuthenticationManagerBuilder {

static func buildAuthenticationManager(redeemUseCase: RedeemUseCase = RedeemUseCase(),
subscriptionManager: SubscriptionManager) -> DataBrokerProtectionAuthenticationManager {
static func buildAuthenticationManager(subscriptionManager: SubscriptionManager) -> DataBrokerProtectionAuthenticationManager {
let subscriptionManager = DataBrokerProtectionSubscriptionManager(subscriptionManager: subscriptionManager)
return DataBrokerProtectionAuthenticationManager(redeemUseCase: redeemUseCase,
subscriptionManager: subscriptionManager)
return DataBrokerProtectionAuthenticationManager(subscriptionManager: subscriptionManager)

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ final class DuckDuckGoDBPBackgroundAgentAppDelegate: NSObject, NSApplicationDele
func applicationDidFinishLaunching(_ aNotification: Notification) {
Logger.dbpBackgroundAgent.log("DuckDuckGoAgent started")

let redeemUseCase = RedeemUseCase(authenticationService: AuthenticationService(),
authenticationRepository: KeychainAuthenticationData())
let authenticationManager = DataBrokerAuthenticationManagerBuilder.buildAuthenticationManager(redeemUseCase: redeemUseCase,
subscriptionManager: subscriptionManager)
let authenticationManager = DataBrokerAuthenticationManagerBuilder.buildAuthenticationManager(subscriptionManager: subscriptionManager)
manager = DataBrokerProtectionAgentManagerProvider.agentManager(authenticationManager: authenticationManager,
accountManager: subscriptionManager.accountManager)
manager?.agentFinishedLaunching()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,21 @@

import Foundation

public enum AuthenticationError: Error, Equatable {
case noInviteCode
case cantGenerateURL
case noAuthToken
case issueRedeemingInviteCode(error: String)
}

public protocol DataBrokerProtectionAuthenticationManaging {
var isUserAuthenticated: Bool { get }
var accessToken: String? { get }
func hasValidEntitlement() async throws -> Bool
func shouldAskForInviteCode() -> Bool
func redeem(inviteCode: String) async throws
func getAuthHeader() -> String?
}

public final class DataBrokerProtectionAuthenticationManager: DataBrokerProtectionAuthenticationManaging {
private let redeemUseCase: DataBrokerProtectionRedeemUseCase
private let subscriptionManager: DataBrokerProtectionSubscriptionManaging

public var isUserAuthenticated: Bool {
Expand All @@ -39,9 +43,7 @@ public final class DataBrokerProtectionAuthenticationManager: DataBrokerProtecti
subscriptionManager.accessToken
}

public init(redeemUseCase: any DataBrokerProtectionRedeemUseCase,
subscriptionManager: any DataBrokerProtectionSubscriptionManaging) {
self.redeemUseCase = redeemUseCase
public init(subscriptionManager: any DataBrokerProtectionSubscriptionManaging) {
self.subscriptionManager = subscriptionManager
}

Expand All @@ -52,18 +54,4 @@ public final class DataBrokerProtectionAuthenticationManager: DataBrokerProtecti
public func getAuthHeader() -> String? {
ServicesAuthHeaderBuilder().getAuthHeader(accessToken)
}

// MARK: - Redeem code flow

// We might want the ability to ask for invite code later on, keeping this here to make things easier
// https://app.asana.com/0/1204167627774280/1207270521849479/f

public func shouldAskForInviteCode() -> Bool {
// redeemUseCase.shouldAskForInviteCode()
return false
}

public func redeem(inviteCode: String) async throws {
// await redeemUseCase.redeem(inviteCode: inviteCode)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,26 @@ protocol DataBrokerProtectionBackendServicePixels {
final class DefaultDataBrokerProtectionBackendServicePixels: DataBrokerProtectionBackendServicePixels {
private let pixelHandler: EventMapping<DataBrokerProtectionPixels>
private let settings: DataBrokerProtectionSettings
private let authRepository: AuthenticationRepository

init(pixelHandler: EventMapping<DataBrokerProtectionPixels> = DataBrokerProtectionPixelsHandler(),
settings: DataBrokerProtectionSettings = DataBrokerProtectionSettings(),
authRepository: AuthenticationRepository = KeychainAuthenticationData()) {
settings: DataBrokerProtectionSettings = DataBrokerProtectionSettings()) {
self.pixelHandler = pixelHandler
self.settings = settings
self.authRepository = authRepository
}

func fireGenerateEmailHTTPError(statusCode: Int) {
let environment = settings.selectedEnvironment.rawValue
let wasOnWaitlist = authRepository.getWaitlistTimestamp() != nil

pixelHandler.fire(.generateEmailHTTPErrorDaily(statusCode: statusCode,
environment: environment,
wasOnWaitlist: wasOnWaitlist))
wasOnWaitlist: false))
}

func fireEmptyAccessToken(callSite: BackendServiceCallSite) {
let environment = settings.selectedEnvironment.rawValue
let wasOnWaitlist = authRepository.getWaitlistTimestamp() != nil

pixelHandler.fire(.emptyAccessTokenDaily(environment: environment,
wasOnWaitlist: wasOnWaitlist,
wasOnWaitlist: false,
callSite: callSite))
}
}

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Loading
Loading