Skip to content

Commit

Permalink
Merge branch 'main' into sabrina/permanent-survey
Browse files Browse the repository at this point in the history
  • Loading branch information
SabrinaTardio committed Apr 19, 2024
2 parents ec30f87 + b52bbb0 commit 551b09b
Show file tree
Hide file tree
Showing 25 changed files with 598 additions and 145 deletions.
2 changes: 1 addition & 1 deletion Configuration/BuildNumber.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 166
CURRENT_PROJECT_VERSION = 168
3 changes: 3 additions & 0 deletions DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,9 @@ struct UserText {
static let bitwardenError = NSLocalizedString("bitwarden.error", value: "Unable to find or connect to Bitwarden", comment: "This message appears when the application is unable to find or connect to Bitwarden, indicating a connection issue.")
static let bitwardenNotInstalled = NSLocalizedString("bitwarden.not.installed", value: "Bitwarden app is not installed", comment: "")
static let bitwardenOldVersion = NSLocalizedString("bitwarden.old.version", value: "Please update Bitwarden to the latest version", comment: "Message that warns user they need to update their password manager Bitwarden app vesion")
static let bitwardenIncompatible = NSLocalizedString("bitwarden.incompatible", value: "The following Bitwarden versions are incompatible with DuckDuckGo: v2024.3.0, v2024.3.2, v2024.4.0, v2024.4.1. Please revert to an older version by following these steps:", comment: "Message that warns user that specific Bitwarden app vesions are not compatible with this app")
static let bitwardenIncompatibleStep1 = NSLocalizedString("bitwarden.incompatible.step.1", value: "Download v2014.2.1", comment: "First step to downgrade Bitwarden")
static let bitwardenIncompatibleStep2 = NSLocalizedString("bitwarden.incompatible.step.2", value: "2. Open the downloaded DMG file and drag the Bitwarden application to\nthe /Applications folder.", comment: "Second step to downgrade Bitwarden")
static let bitwardenIntegrationNotApproved = NSLocalizedString("bitwarden.integration.not.approved", value: "Integration with DuckDuckGo is not approved in Bitwarden app", comment: "While the user tries to connect the DuckDuckGo Browser to password manager Bitwarden This message indicates that the integration with DuckDuckGo has not been approved in the Bitwarden app.")
static let bitwardenMissingHandshake = NSLocalizedString("bitwarden.missing.handshake", value: "Missing handshake", comment: "While the user tries to connect the DuckDuckGo Browser to password manager Bitwarden This message indicates a missing handshake (a way for two devices or systems to say hello to each other and agree to communicate or exchange information).")
static let bitwardenWaitingForHandshake = NSLocalizedString("bitwarden.waiting.for.handshake", value: "Waiting for the handshake approval in Bitwarden app", comment: "While the user tries to connect the DuckDuckGo Browser to password manager Bitwarden This message indicates the system is waiting for the handshake (a way for two devices or systems to say hello to each other and agree to communicate or exchange information).")
Expand Down
4 changes: 3 additions & 1 deletion DuckDuckGo/DBP/DBPHomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ public class DataBrokerProtectionPixelsHandler: EventMapping<DataBrokerProtectio
.scanningEventReAppearance,
.webUILoadingFailed,
.webUILoadingStarted,
.webUILoadingSuccess:
.webUILoadingSuccess,
.emptyAccessTokenDaily,
.generateEmailHTTPErrorDaily:
PixelKit.fire(event)
}
}
Expand Down
45 changes: 2 additions & 43 deletions DuckDuckGo/HomePage/Model/HomePageContinueSetUpModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ extension HomePage.Models {
return !featuresMatrix.isEmpty
}

lazy var waitlistBetaThankYouPresenter = WaitlistThankYouPromptPresenter()

lazy var listOfFeatures = isFirstSession ? firstRunFeatures : randomisedFeatures

private var featuresMatrix: [[FeatureType]] = [[]] {
Expand Down Expand Up @@ -154,14 +152,6 @@ extension HomePage.Models {
#if DBP
DataBrokerProtectionAppEvents().handleWaitlistInvitedNotification(source: .cardUI)
#endif
case .vpnThankYou:
guard let window = NSApp.keyWindow,
case .normal = NSApp.runType else { return }
waitlistBetaThankYouPresenter.presentVPNThankYouPrompt(in: window)
case .pirThankYou:
guard let window = NSApp.keyWindow,
case .normal = NSApp.runType else { return }
waitlistBetaThankYouPresenter.presentPIRThankYouPrompt(in: window)
}
}

Expand All @@ -187,10 +177,6 @@ extension HomePage.Models {
#endif
case .dataBrokerProtectionWaitlistInvited:
shouldShowDBPWaitlistInvitedCardUI = false
case .vpnThankYou:
waitlistBetaThankYouPresenter.didDismissVPNThankYouCard()
case .pirThankYou:
waitlistBetaThankYouPresenter.didDismissPIRThankYouCard()
}
refreshFeaturesMatrix()
}
Expand All @@ -212,15 +198,8 @@ extension HomePage.Models {
PixelKit.fire(GeneralPixel.networkProtectionRemoteMessageDisplayed(messageID: message.id), frequency: .daily)
}

if waitlistBetaThankYouPresenter.canShowVPNCard {
features.append(.vpnThankYou)
}

if waitlistBetaThankYouPresenter.canShowPIRCard {
features.append(.pirThankYou)
}

appendFeatureCards(&features)

featuresMatrix = features.chunked(into: itemsPerRow)
}

Expand All @@ -244,9 +223,7 @@ extension HomePage.Models {
return shouldPermanentSurveyBeVisible
case .networkProtectionRemoteMessage,
.dataBrokerProtectionRemoteMessage,
.dataBrokerProtectionWaitlistInvited,
.vpnThankYou,
.pirThankYou:
.dataBrokerProtectionWaitlistInvited:
return false // These are handled separately
}
}
Expand Down Expand Up @@ -404,8 +381,6 @@ extension HomePage.Models {
case networkProtectionRemoteMessage(NetworkProtectionRemoteMessage)
case dataBrokerProtectionRemoteMessage(DataBrokerProtectionRemoteMessage)
case dataBrokerProtectionWaitlistInvited
case vpnThankYou
case pirThankYou

var title: String {
switch self {
Expand All @@ -425,10 +400,6 @@ extension HomePage.Models {
return message.cardTitle
case .dataBrokerProtectionWaitlistInvited:
return "Personal Information Removal"
case .vpnThankYou:
return "Thanks for testing DuckDuckGo VPN!"
case .pirThankYou:
return "Thanks for testing Personal Information Removal!"
}
}

Expand All @@ -450,10 +421,6 @@ extension HomePage.Models {
return message.cardDescription
case .dataBrokerProtectionWaitlistInvited:
return "You're invited to try Personal Information Removal beta!"
case .vpnThankYou:
return "To keep using it, subscribe to DuckDuckGo Privacy Pro."
case .pirThankYou:
return "To keep using it, subscribe to DuckDuckGo Privacy Pro."
}
}

Expand All @@ -475,10 +442,6 @@ extension HomePage.Models {
return message.action.actionTitle
case .dataBrokerProtectionWaitlistInvited:
return "Get Started"
case .vpnThankYou:
return "See Special Offer For Testers"
case .pirThankYou:
return "See Special Offer For Testers"
}
}

Expand All @@ -502,10 +465,6 @@ extension HomePage.Models {
return .dbpInformationRemover.resized(to: iconSize)!
case .dataBrokerProtectionWaitlistInvited:
return .dbpInformationRemover.resized(to: iconSize)!
case .vpnThankYou:
return .vpnEnded.resized(to: iconSize)!
case .pirThankYou:
return .dbpInformationRemover.resized(to: iconSize)!
}
}
}
Expand Down
45 changes: 45 additions & 0 deletions DuckDuckGo/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,12 @@
}
}
}
},
"1." : {

},
"2. Open the downloaded DMG file and drag the Bitwarden application to\nthe /Applications folder." : {

},
"about.app_name" : {
"comment" : "Application name to be displayed in the About dialog",
Expand Down Expand Up @@ -6253,6 +6259,42 @@
}
}
},
"bitwarden.incompatible" : {
"comment" : "Message that warns user that specific Bitwarden app vesions are not compatible with this app",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "The following Bitwarden versions are incompatible with DuckDuckGo: v2024.3.0, v2024.3.2, v2024.4.0, v2024.4.1. Please revert to an older version by following these steps:"
}
}
}
},
"bitwarden.incompatible.step.1" : {
"comment" : "First step to downgrade Bitwarden",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Download v2014.2.1"
}
}
}
},
"bitwarden.incompatible.step.2" : {
"comment" : "Second step to downgrade Bitwarden",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "2. Open the downloaded DMG file and drag the Bitwarden application to\nthe /Applications folder."
}
}
}
},
"bitwarden.install" : {
"comment" : "Button to install Bitwarden app",
"extractionState" : "extracted_with_value",
Expand Down Expand Up @@ -13288,6 +13330,9 @@
}
}
}
},
"Download v2014.2.1" : {

},
"download.finishing" : {
"comment" : "Download being finished information text",
Expand Down
11 changes: 0 additions & 11 deletions DuckDuckGo/MainWindow/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ final class MainViewController: NSViewController {
updateReloadMenuItem()
updateStopMenuItem()
browserTabViewController.windowDidBecomeKey()
presentWaitlistThankYouPromptIfNecessary()

refreshNetworkProtectionMessages()

Expand Down Expand Up @@ -430,16 +429,6 @@ final class MainViewController: NSViewController {
NSApp.mainMenuTyped.stopMenuItem.isEnabled = selectedTabViewModel.isLoading
}

func presentWaitlistThankYouPromptIfNecessary() {
guard let window = self.view.window else {
assertionFailure("Couldn't get main view controller's window")
return
}

let presenter = WaitlistThankYouPromptPresenter()
presenter.presentThankYouPromptIfNecessary(in: window)
}

// MARK: - First responder

func adjustFirstResponder(selectedTabViewModel: TabViewModel? = nil, tabContent: Tab.TabContent? = nil, force: Bool = false) {
Expand Down
4 changes: 4 additions & 0 deletions DuckDuckGo/PasswordManager/Bitwarden/Model/BWManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ final class BWManager: BWManagement, ObservableObject {
status = .oldVersion
scheduleConnectionAttempt()
return
case .incompatible:
status = .incompatible
scheduleConnectionAttempt()
return
case .installed:
break
}
Expand Down
1 change: 1 addition & 0 deletions DuckDuckGo/PasswordManager/Bitwarden/Model/BWStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ enum BWStatus: Equatable {

// Installed Bitwarden doesn't support the integration
case oldVersion
case incompatible

// Bitwarden application isn't running
case notRunning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum BWInstallationState {

case notInstalled
case oldVersion
case incompatible
case installed

}
Expand All @@ -41,6 +42,7 @@ final class LocalBitwardenInstallationService: BWInstallationService {
static var bundlePath = "/Applications/Bitwarden.app"
private lazy var bundleUrl = URL(fileURLWithPath: Self.bundlePath)
static var minimumVersion = "2022.10.1"
static var incompatibleVersions = ["2024.3.0", "2024.3.2", "2024.4.0", "2024.4.1"]

private lazy var manifestPath: String = {
#if DEBUG
Expand Down Expand Up @@ -75,6 +77,10 @@ final class LocalBitwardenInstallationService: BWInstallationService {
return .oldVersion
}

guard !Self.incompatibleVersions.contains(version) else {
return .incompatible
}

return .installed
}

Expand Down Expand Up @@ -124,7 +130,7 @@ final class LocalBitwardenInstallationService: BWInstallationService {
private func isIntegrationEnabled(in dataFileURL: URL) -> Bool {
do {
let dataFile = try String(contentsOf: dataFileURL)
return dataFile.range(of: "\"enableDuckDuckGoBrowserIntegration\": true") != nil
return dataFile.range(of: "enableDuckDuckGoBrowserIntegration\": true") != nil
} catch {
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ struct ConnectBitwardenView: View {
@ViewBuilder private func bodyView(for state: ConnectBitwardenViewModel.ViewState) -> some View {
switch viewModel.viewState {
case .disclaimer: ConnectToBitwardenDisclaimerView()
case .lookingForBitwarden: BitwardenInstallationDetectionView(bitwardenDetected: false, bitwardenNeedsUpdate: false)
case .oldVersion: BitwardenInstallationDetectionView(bitwardenDetected: true, bitwardenNeedsUpdate: true)
case .bitwardenFound: BitwardenInstallationDetectionView(bitwardenDetected: true, bitwardenNeedsUpdate: false)
case .lookingForBitwarden: BitwardenInstallationDetectionView(bitwardenDetected: false, bitwardenNeedsUpdate: false, bitwardenIsIncompatible: false)
case .incompatible: BitwardenInstallationDetectionView(bitwardenDetected: true, bitwardenNeedsUpdate: false, bitwardenIsIncompatible: true)
case .oldVersion: BitwardenInstallationDetectionView(bitwardenDetected: true, bitwardenNeedsUpdate: true, bitwardenIsIncompatible: false)
case .bitwardenFound: BitwardenInstallationDetectionView(bitwardenDetected: true, bitwardenNeedsUpdate: false, bitwardenIsIncompatible: false)
case .accessToContainersNotApproved: ConnectToBitwardenView(canConnect: false, canNotAccessSandboxContainers: true)
case .waitingForConnectionPermission: ConnectToBitwardenView(canConnect: false, canNotAccessSandboxContainers: false)
case .connectToBitwarden: ConnectToBitwardenView(canConnect: true, canNotAccessSandboxContainers: false)
Expand Down Expand Up @@ -155,44 +156,55 @@ private struct BitwardenInstallationDetectionView: View {

let bitwardenDetected: Bool
let bitwardenNeedsUpdate: Bool
let bitwardenIsIncompatible: Bool

var body: some View {

VStack(alignment: .leading, spacing: 10) {
Text(UserText.installBitwarden)
.font(.system(size: 13, weight: .bold))

HStack {
NumberedBadge(value: 1)

Text(UserText.installBitwardenInfo)
if !bitwardenIsIncompatible {
Text(UserText.installBitwarden)
.font(.system(size: 13, weight: .bold))

Spacer()
}

HStack {
NumberedBadge(value: 2)
HStack {
NumberedBadge(value: 1)
Text(UserText.installBitwardenInfo)
Spacer()
}

Text(UserText.afterBitwardenInstallationInfo)
HStack {
NumberedBadge(value: 2)
Text(UserText.afterBitwardenInstallationInfo)
Spacer()
}

Spacer()
Button(action: {
viewModel.process(action: .openBitwardenProductPage)
}, label: {
Image(.macAppStoreButton)
})
.buttonStyle(PlainButtonStyle())
.frame(width: 156, height: 40)
}

Button(action: {
viewModel.process(action: .openBitwardenProductPage)
}, label: {
Image(.macAppStoreButton)
})
.buttonStyle(PlainButtonStyle())
.frame(width: 156, height: 40)

if bitwardenDetected {
if bitwardenNeedsUpdate {
HStack {
ActivityIndicator(isAnimating: .constant(true), style: .spinning)

Text(UserText.bitwardenOldVersion)
}
} else if bitwardenIsIncompatible {
HStack {
ActivityIndicator(isAnimating: .constant(true), style: .spinning)

VStack(alignment: .leading) {
Text(UserText.bitwardenIncompatible)
.lineLimit(nil)
.fixedSize(horizontal: false, vertical: true)
BitwardenDowngradeInfoView()
}
}
} else {
HStack {
Image(.successCheckmark)
Expand Down
Loading

0 comments on commit 551b09b

Please sign in to comment.