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

Subscription design review fixes #2420

Merged
merged 7 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file modified DuckDuckGo/Assets.xcassets/Images/ITR-Icon.imageset/ITR-Icon.pdf
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extension UserText {
// "network.protection.tunnel.name" - The name of the NetP VPN that will be visible in the system to the user
static let networkProtectionTunnelName = "DuckDuckGo Network Protection"
// "network.protection" - Menu item for opening Network Protection
static let networkProtection = "Network Protection"
static let networkProtection = "VPN"

// MARK: - Navigation Bar
// "network.protection.status.button.tooltip" - The tooltip for NetP's nav bar button
Expand Down
1 change: 0 additions & 1 deletion DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,6 @@ struct UserText {

// "data-broker-protection.optionsMenu" - Menu item data broker protection feature
static let dataBrokerProtectionOptionsMenuItem = "Personal Information Removal"
static let dataBrokerProtectionScanOptionsMenuItem = "Personal Information Removal Scan"
// "tab.dbp.title" - Tab data broker protection title
static let tabDataBrokerProtectionTitle = "Personal Information Removal"

Expand Down
17 changes: 6 additions & 11 deletions DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -343,21 +343,22 @@ final class MoreOptionsMenu: NSMenu {

#if NETWORK_PROTECTION
if networkProtectionFeatureVisibility.isNetworkProtectionVisible() {
let networkProtectionItem: NSMenuItem

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

let networkProtectionItem: NSMenuItem

// If the user can see the Network Protection 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 {
if DefaultSubscriptionFeatureAvailability().isFeatureAvailable() {
networkProtectionItem = makeNetworkProtectionItem(showNewLabel: false)
} else if !isWaitlistUser && !hasAuthToken {
networkProtectionItem = makeNetworkProtectionItem(showNewLabel: true)
} else {
networkProtectionItem = makeNetworkProtectionItem(showNewLabel: false)
}

items.append(networkProtectionItem)

#if SUBSCRIPTION
if DefaultSubscriptionFeatureAvailability().isFeatureAvailable() && AccountManager().isUserAuthenticated {
Task {
Expand Down Expand Up @@ -445,19 +446,13 @@ final class MoreOptionsMenu: NSMenu {

#if SUBSCRIPTION
private func makeInactiveSubscriptionItems() -> [NSMenuItem] {
let dataBrokerProtectionItem = NSMenuItem(title: UserText.dataBrokerProtectionScanOptionsMenuItem,
action: #selector(openSubscriptionPurchasePage(_:)),
keyEquivalent: "")
.targetting(self)
.withImage(.dbpIcon)

let privacyProItem = NSMenuItem(title: UserText.subscriptionOptionsMenuItem,
action: #selector(openSubscriptionPurchasePage(_:)),
keyEquivalent: "")
.targetting(self)
.withImage(.subscriptionIcon)

return [dataBrokerProtectionItem, privacyProItem]
return [privacyProItem]
}
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public final class PreferencesSubscriptionModel: ObservableObject {

private var dateFormatter = {
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .medium
dateFormatter.dateStyle = .long
dateFormatter.timeStyle = .none

return dateFormatter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public struct PreferencesSubscriptionView: View {
showingSheet.toggle()
model.userEventHandler(.iHaveASubscriptionClick)
}
.buttonStyle(DismissActionButtonStyle())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
//

import Foundation
import Subscription

public final class ActivateSubscriptionAccessModel: SubscriptionAccessModel, PurchaseRestoringSubscriptionAccessModel {
private var actionHandlers: SubscriptionAccessActionHandlers

public var title = UserText.activateModalTitle
public var description = UserText.activateModalDescription
public var description = UserText.activateModalDescription(platform: SubscriptionPurchaseEnvironment.current)

public var email: String?
public var emailLabel: String { UserText.email }
Expand All @@ -31,7 +32,7 @@ public final class ActivateSubscriptionAccessModel: SubscriptionAccessModel, Pur

public private(set) var shouldShowRestorePurchase: Bool
public var restorePurchaseDescription = UserText.restorePurchaseDescription
public var restorePurchaseButtonTitle = UserText.restorePurchasesButton
public var restorePurchaseButtonTitle = UserText.restorePurchaseButton

public init(actionHandlers: SubscriptionAccessActionHandlers, shouldShowRestorePurchase: Bool) {
self.actionHandlers = actionHandlers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Subscription

public final class ShareSubscriptionAccessModel: SubscriptionAccessModel {
public var title = UserText.shareModalTitle
public var description = UserText.shareModalDescription
public var description = UserText.shareModalDescription(platform: SubscriptionPurchaseEnvironment.current)

private let subscriptionAppGroup: String
private var actionHandlers: SubscriptionAccessActionHandlers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public struct SubscriptionAccessView: View {
Button("Cancel") {
dismiss()
}
.buttonStyle(DismissActionButtonStyle())
}
.padding(.horizontal, 20)
.padding(.vertical, 16)
Expand Down
27 changes: 20 additions & 7 deletions LocalPackages/SubscriptionUI/Sources/SubscriptionUI/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//

import Foundation
import Subscription

enum UserText {
// MARK: - Subscription preferences
Expand Down Expand Up @@ -77,8 +78,6 @@ enum UserText {
static let preferencesSubscriptionPendingHeader = NSLocalizedString("subscription.preferences.subscription.pending.header", value: "Your Subscription is Being Activated", comment: "Header for the subscription preferences pane when the subscription activation is pending")
static let preferencesSubscriptionPendingCaption = NSLocalizedString("subscription.preferences.subscription.pending.caption", value: "This is taking longer than usual, please check back later.", comment: "Caption for the subscription preferences pane when the subscription activation is pending")

static let restorePurchaseButton = NSLocalizedString("subscription.preferences.restore.purchase.button", value: "Restore Purchase", comment: "Button to restore past purchases")

// MARK: Preferences when subscription is expired
static let preferencesSubscriptionExpiredCaption = NSLocalizedString("subscription.preferences.subscription.expired.caption", value: "Subscribe again to continue using Privacy Pro.", comment: "Caption for the subscription preferences pane when the subscription activation is pending")

Expand All @@ -101,22 +100,36 @@ enum UserText {

// MARK: - Activate subscription modal
static let activateModalTitle = NSLocalizedString("subscription.activate.modal.title", value: "Activate your subscription on this device", comment: "Activate subscription modal view title")
static let activateModalDescription = NSLocalizedString("subscription.activate.modal.description", value: "Access your subscription on other devices via Apple ID or an 
email address.", comment: "Activate subscription modal view subtitle description")
static func activateModalDescription(platform: SubscriptionPurchaseEnvironment.Environment) -> String {
switch platform {
case .appStore:
NSLocalizedString("subscription.appstore.activate.modal.description", value: "Access your subscription on other devices via Apple ID or an email address.", comment: "Activate subscription modal view subtitle description")
case .stripe:
NSLocalizedString("subscription.activate.modal.description", value: "Access your subscription on other devices via an email address.", comment: "Activate subscription modal view subtitle description")
}
}

static let activateModalEmailDescription = NSLocalizedString("subscription.activate.modal.email.description", value: "Use your email to access your subscription on this device.", comment: "Activate subscription modal description for email address channel")
static let activateModalEmailDescription = NSLocalizedString("subscription.activate.modal.email.description", value: "Use your email to activate your subscription on this device.", comment: "Activate subscription modal description for email address channel")
static let restorePurchaseDescription = NSLocalizedString("subscription.activate.modal.restore.purchase.description", value: "Your subscription is automatically available in DuckDuckGo on any device signed in to your Apple ID.", comment: "Activate subscription modal description via restore purchase from Apple ID")

// MARK: - Share subscription modal
static let shareModalTitle = NSLocalizedString("subscription.share.modal.title", value: "Use your subscription on all your devices", comment: "Share subscription modal view title")
static let shareModalDescription = NSLocalizedString("subscription.share.modal.description", value: "Access your Privacy Pro subscription on any of your devices via Sync, Apple ID or by adding an email address.", comment: "Share subscription modal view subtitle description")
static let shareModalTitle = NSLocalizedString("subscription.share.modal.title", value: "Use your subscription on other devices", comment: "Share subscription modal view title")
static func shareModalDescription(platform: SubscriptionPurchaseEnvironment.Environment) -> String {
switch platform {
case .appStore:
NSLocalizedString("subscription.appstore.share.modal.description", value: "Access your subscription via Apple ID or by adding an email address.", comment: "Share subscription modal view subtitle description")
case .stripe:
NSLocalizedString("subscription.share.modal.description", value: "Activate your Privacy Pro subscription via an email address.", comment: "Share subscription modal view subtitle description")
}
}

static let shareModalHasEmailDescription = NSLocalizedString("subscription.share.modal.has.email.description", value: "Use this email to activate your subscription on other devices. Open the DuckDuckGo app on another device and find Privacy Pro in browser settings.", comment: "Share subscription modal description for email address channel")
static let shareModalNoEmailDescription = NSLocalizedString("subscription.share.modal.no.email.description", value: "Add an email address to access your subscription in DuckDuckGo on other devices. We’ll only use this address to verify your subscription.", comment: "Share subscription modal description for email address channel")

static let restorePurchasesDescription = NSLocalizedString("subscription.share.modal.restore.purchases.description", value: "Your subscription is automatically available in DuckDuckGo on any device signed in to your Apple ID.", comment: "Share subscription modal description for restoring Apple ID purchases")

// MARK: - Activate/share modal buttons
static let restorePurchasesButton = NSLocalizedString("subscription.modal.restore.purchases.button", value: "Restore Purchases", comment: "Button for restoring past subscription purchases")
static let restorePurchaseButton = NSLocalizedString("subscription.modal.restore.purchase.button", value: "Restore Purchase", comment: "Button for restoring past subscription purchase")
static let manageEmailButton = NSLocalizedString("subscription.modal.manage.email.button", value: "Manage Email", comment: "Button for opening manage email address page")
static let enterEmailButton = NSLocalizedString("subscription.modal.enter.email.button", value: "Enter Email", comment: "Button for opening page to enter email address")
static let addEmailButton = NSLocalizedString("subscription.modal.add.email.button", value: "Add Email", comment: "Button for opening page to add email address")
Expand Down
Loading