Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Edit the line up promotion and hide if subscription kind exists
Browse files Browse the repository at this point in the history
  • Loading branch information
soner-yuksel committed Nov 16, 2023
1 parent 004bab5 commit 4f71c3a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions App/iOS/Delegates/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Editing Product Promotion List
Task { @MainActor in
await BraveVPN.updateStorePromotionOrder()
await BraveVPN.hideActiveStorePromotion()
}

// Override point for customization after application launch.
Expand Down
12 changes: 10 additions & 2 deletions Sources/BraveVPN/BraveVPN.swift
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ public class BraveVPN {

// MARK: - Promotion

/// Editing product promotion order first monthly and yearly after
/// Editing product promotion order first yearly and monthly after
@MainActor public static func updateStorePromotionOrder() async {
let storePromotionController = SKProductStorePromotionController.default()
// Fetch Products
Expand All @@ -687,7 +687,7 @@ public class BraveVPN {

// Update the order
do {
try await storePromotionController.update(promotionOrder: [monthlyProduct, yearlyProduct])
try await storePromotionController.update(promotionOrder: [yearlyProduct, monthlyProduct])
} catch {
Logger.module.debug("Error while opdating product promotion order ")
}
Expand All @@ -704,6 +704,14 @@ public class BraveVPN {
return
}

// No promotion for VPN is purchased through website side
if Preferences.VPN.skusCredential.value != nil {
await hideSubscriptionType(yearlyProduct)
await hideSubscriptionType(monthlyProduct)

return
}

// Hide the promotion
let activeSubscriptionType = BraveVPN.activeSubscriptionType

Expand Down

0 comments on commit 4f71c3a

Please sign in to comment.