From 04c2026176488b70cb83b26dddfac9474b46fe9e Mon Sep 17 00:00:00 2001 From: Fernando Bunn Date: Tue, 19 Mar 2024 22:05:16 +0000 Subject: [PATCH] Connect thank you message to DBP method (#2456) Task/Issue URL: https://app.asana.com/0/1204167627774280/1206824862073996/f Tech Design URL: CC: **Description**: Connect thank you message to DBP method --- .../DBP/DataBrokerProtectionFeatureVisibility.swift | 11 +++++++++-- .../Views/WaitlistThankYouPromptPresenter.swift | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/DuckDuckGo/DBP/DataBrokerProtectionFeatureVisibility.swift b/DuckDuckGo/DBP/DataBrokerProtectionFeatureVisibility.swift index 3f7f04f97f..46de122bd1 100644 --- a/DuckDuckGo/DBP/DataBrokerProtectionFeatureVisibility.swift +++ b/DuckDuckGo/DBP/DataBrokerProtectionFeatureVisibility.swift @@ -28,6 +28,7 @@ protocol DataBrokerProtectionFeatureVisibility { func disableAndDeleteForAllUsers() func disableAndDeleteForWaitlistUsers() func isPrivacyProEnabled() -> Bool + func isEligibleForThankYouMessage() -> Bool } struct DefaultDataBrokerProtectionFeatureVisibility: DataBrokerProtectionFeatureVisibility { @@ -91,6 +92,10 @@ struct DefaultDataBrokerProtectionFeatureVisibility: DataBrokerProtectionFeature DataBrokerProtectionWaitlist().waitlistStorage.isWaitlistUser } + private var wasWaitlistUser: Bool { + DataBrokerProtectionWaitlist().waitlistStorage.getWaitlistInviteCode() != nil + } + func isPrivacyProEnabled() -> Bool { #if SUBSCRIPTION return NSApp.delegateTyped.subscriptionFeatureAvailability.isFeatureAvailable @@ -100,6 +105,10 @@ struct DefaultDataBrokerProtectionFeatureVisibility: DataBrokerProtectionFeature } + func isEligibleForThankYouMessage() -> Bool { + return wasWaitlistUser && isPrivacyProEnabled() + } + func disableAndDeleteForAllUsers() { featureDisabler.disableAndDelete() @@ -117,8 +126,6 @@ struct DefaultDataBrokerProtectionFeatureVisibility: DataBrokerProtectionFeature /// Returns true if a cleanup was performed, false otherwise func cleanUpDBPForPrivacyProIfNecessary() -> Bool { - let wasWaitlistUser = DataBrokerProtectionWaitlist().waitlistStorage.getWaitlistInviteCode() != nil - if isPrivacyProEnabled() && wasWaitlistUser && !dataBrokerProtectionCleanedUpFromWaitlistToPrivacyPro { disableAndDeleteForWaitlistUsers() dataBrokerProtectionCleanedUpFromWaitlistToPrivacyPro = true diff --git a/DuckDuckGo/Waitlist/Views/WaitlistThankYouPromptPresenter.swift b/DuckDuckGo/Waitlist/Views/WaitlistThankYouPromptPresenter.swift index 81fa1f9179..78eecff705 100644 --- a/DuckDuckGo/Waitlist/Views/WaitlistThankYouPromptPresenter.swift +++ b/DuckDuckGo/Waitlist/Views/WaitlistThankYouPromptPresenter.swift @@ -34,7 +34,7 @@ final class WaitlistThankYouPromptPresenter { self.init(isVPNBetaTester: { return false }, isPIRBetaTester: { - return false + return DefaultDataBrokerProtectionFeatureVisibility().isEligibleForThankYouMessage() }) }