Skip to content

Commit

Permalink
Removing some waitlist code (#2406)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/0/1206800069675135/f

## Description

Removing some of our waitlist code so that nothing screams "new" for the
VPN.
  • Loading branch information
diegoreymendez authored Mar 14, 2024
1 parent b4b968d commit ddf8b04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 46 deletions.
28 changes: 3 additions & 25 deletions DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -339,18 +339,9 @@ final class MoreOptionsMenu: NSMenu {

#if NETWORK_PROTECTION
if networkProtectionFeatureVisibility.isNetworkProtectionVisible() {
let isWaitlistUser = NetworkProtectionWaitlist().waitlistStorage.isWaitlistUser
let hasAuthToken = NetworkProtectionKeychainTokenStore().isFeatureActivated

let networkProtectionItem: NSMenuItem

// If the user can see the VPN option but they haven't joined the waitlist or don't have an auth token, show the "New"
// badge to bring it to their attention.
if !isWaitlistUser && !hasAuthToken {
networkProtectionItem = makeNetworkProtectionItem(showNewLabel: true)
} else {
networkProtectionItem = makeNetworkProtectionItem(showNewLabel: false)
}
networkProtectionItem = makeNetworkProtectionItem()

items.append(networkProtectionItem)

Expand Down Expand Up @@ -490,25 +481,12 @@ final class MoreOptionsMenu: NSMenu {
}

#if NETWORK_PROTECTION
private func makeNetworkProtectionItem(showNewLabel: Bool) -> NSMenuItem {
private func makeNetworkProtectionItem() -> NSMenuItem {
let networkProtectionItem = NSMenuItem(title: "", action: #selector(showNetworkProtectionStatus(_:)), keyEquivalent: "")
.targetting(self)
.withImage(.image(for: .vpnIcon))

if showNewLabel {
let attributedText = NSMutableAttributedString(string: UserText.networkProtection)
attributedText.append(NSAttributedString(string: " "))

let imageAttachment = NSTextAttachment()
imageAttachment.image = .newLabel
imageAttachment.setImageHeight(height: 16, offset: .init(x: 0, y: -4))

attributedText.append(NSAttributedString(attachment: imageAttachment))

networkProtectionItem.attributedTitle = attributedText
} else {
networkProtectionItem.title = UserText.networkProtection
}
networkProtectionItem.title = UserText.networkProtection

return networkProtectionItem
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,6 @@ final class NetworkProtectionNavBarButtonModel: NSObject, ObservableObject {
guard [.normal, .integrationTests].contains(NSApp.runType) else { return NSImage() }
#endif

let isWaitlistUser = NetworkProtectionWaitlist().waitlistStorage.isWaitlistUser
let hasAuthToken = NetworkProtectionKeychainTokenStore().isFeatureActivated

if !isWaitlistUser && !hasAuthToken {
return .networkProtectionAvailableButton
}

if NetworkProtectionWaitlist().readyToAcceptTermsAndConditions {
return .networkProtectionAvailableButton
}
Expand Down Expand Up @@ -191,20 +184,6 @@ final class NetworkProtectionNavBarButtonModel: NSObject, ObservableObject {
showButton = true
return
}

let waitlist = NetworkProtectionWaitlist()
let isWaitlistUser = waitlist.waitlistStorage.isWaitlistUser
let hasAuthToken = NetworkProtectionKeychainTokenStore().isFeatureActivated

#if !APPSTORE
// If the user hasn't signed up to the waitlist or doesn't have an auth token through some other method, then show them the badged icon
// to get their attention and encourage them to sign up. Also avoid showing the button is the user has opened the waitlist UI but
// dismissed it.
if !isWaitlistUser && !hasAuthToken && !waitlist.waitlistSignUpPromptDismissed {
showButton = true
return
}
#endif
}

guard !isPinned,
Expand Down

0 comments on commit ddf8b04

Please sign in to comment.