Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon-T committed Oct 16, 2024
1 parent 56bbf84 commit 92dfcdb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion ios/brave-ios/Sources/AIChat/AIChatStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ extension Strings {
bundle: .module,
value: "BEST VALUE",
comment:
"The description indicating yearly subscription that show how much user is saving percentage"
"The description indicating how valuable the yearly subscription is, compared to purchasing monthly"
)
public static let paywallYearlyPriceDividend = NSLocalizedString(
"aichat.paywallYearlyPriceDividend",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,18 @@ struct AIChatPaywallView: View {
.tint(Color.white)
.padding()
} else {
if (selectedTierType == .monthly && isMonthlyIntroOfferAvailable)
let isIntroOfferAvailable =
(selectedTierType == .monthly && isMonthlyIntroOfferAvailable)
|| (selectedTierType == .yearly && isYearlyIntroOfferAvailable)
{
Text(Strings.AIChat.paywallPurchaseActionIntroOfferTitle)
.font(.body.weight(.semibold))
.foregroundColor(Color(.white))
.padding()
} else {
Text(Strings.AIChat.paywallPurchaseActionTitle)
.font(.body.weight(.semibold))
.foregroundColor(Color(.white))
.padding()
}

Text(
isIntroOfferAvailable
? Strings.AIChat.paywallPurchaseActionIntroOfferTitle
: Strings.AIChat.paywallPurchaseActionTitle
)
.font(.body.weight(.semibold))
.foregroundColor(Color(.white))
.padding()
}
}
.frame(maxWidth: .infinity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,23 +326,20 @@ public class AppStoreSDK: ObservableObject {
/// Retrieves a product's renewable subscription product
/// - Parameter product: The product whose SKU to retrieve
/// - Returns: The AppStore renewable subscription product
@MainActor
public func subscription(for product: any AppStoreProduct) async -> Product? {
allProducts.autoRenewable.first(where: { $0.id == product.rawValue })
}

/// Retrieves a product's renewable subscription status
/// - Parameter product: The product whose subscription status to retrieve
/// - Returns: The renewable subscription's status
@MainActor
public func status(for product: any AppStoreProduct) async -> [Product.SubscriptionInfo.Status] {
(try? await subscription(for: product)?.subscription?.status) ?? []
}

/// Retrieves a product's renewable subscription trial status
/// - Parameter product: The product whose subscription trial status to retrieve
/// - Returns: The renewable subscription's trial status
@MainActor
public func isIntroOfferAvailable(for product: any AppStoreProduct) async -> Bool {
guard let subscription = await subscription(for: product)?.subscription else {
return false
Expand All @@ -358,7 +355,6 @@ public class AppStoreSDK: ObservableObject {
/// Retrieves a product's renewable subscription renewal information
/// - Parameter product: The product whose renewal to retrieve
/// - Returns: The renewable subscription's renewal information
@MainActor
public func renewalState(
for product: any AppStoreProduct
) async -> Product.SubscriptionInfo.RenewalState? {
Expand All @@ -368,7 +364,6 @@ public class AppStoreSDK: ObservableObject {
/// Retrieves a product's transaction history
/// - Parameter product: The product whose last transaction history to retrieve
/// - Returns: The product's latest transaction history
@MainActor
public func latestTransaction(for product: any AppStoreProduct) async -> Transaction? {
if let transaction = await Transaction.latest(for: product.rawValue) {
do {
Expand All @@ -386,7 +381,6 @@ public class AppStoreSDK: ObservableObject {
/// Retrieves a customer's purchase entitlement of a specified product
/// - Parameter product: The product whose current subscription to retrieve
/// - Returns: The current product entitlement/purchase. Null if the customer is not currently entitled to this product
@MainActor
public func currentTransaction(for product: any AppStoreProduct) async -> Transaction? {
if let transaction = await Transaction.currentEntitlement(for: product.rawValue) {
do {
Expand Down

0 comments on commit 92dfcdb

Please sign in to comment.