Pārlūkot izejas kodu

Show subscription-cancel reminder only after lifetime purchase.

Skip the pre-purchase lifetime warning and instead display the cancellation reminder after successful lifetime activation, while keeping the generic premium-upgrade confirmation for non-lifetime plans.

Made-with: Cursor
huzaifahayat12 3 mēneši atpakaļ
vecāks
revīzija
a657c9e36d
1 mainītis faili ar 16 papildinājumiem un 9 dzēšanām
  1. 16 9
      meetings_app/ViewController.swift

+ 16 - 9
meetings_app/ViewController.swift

@@ -1026,13 +1026,8 @@ private extension ViewController {
 
     private func confirmPremiumUpgrade(for targetPlan: PremiumPlan) -> Bool {
         let alert = NSAlert()
-        if targetPlan == .lifetime, storeKitCoordinator.hasPremiumAccess, !storeKitCoordinator.hasLifetimeAccess {
-            alert.messageText = "Switching to Lifetime"
-            alert.informativeText = "You already have an active subscription. If you buy Lifetime, cancel your current subscription in App Store Subscriptions to avoid future renewal charges."
-        } else {
-            alert.messageText = "Already Premium"
-            alert.informativeText = "You are already premium. Do you want to continue with this purchase?"
-        }
+        alert.messageText = "Already Premium"
+        alert.informativeText = "You are already premium. Do you want to continue with this purchase?"
         alert.addButton(withTitle: "Continue")
         alert.addButton(withTitle: "Cancel")
         return alert.runModal() == .alertFirstButtonReturn
@@ -1531,7 +1526,10 @@ private extension ViewController {
             }
             return
         }
-        if paywallUpgradeFlowEnabled && storeKitCoordinator.hasPremiumAccess && !confirmPremiumUpgrade(for: selectedPremiumPlan) {
+        if paywallUpgradeFlowEnabled,
+           storeKitCoordinator.hasPremiumAccess,
+           selectedPremiumPlan != .lifetime,
+           !confirmPremiumUpgrade(for: selectedPremiumPlan) {
             return
         }
         paywallPurchaseTask?.cancel()
@@ -1548,7 +1546,16 @@ private extension ViewController {
                 Task { [weak self] in
                     await self?.loadSchedule()
                 }
-                self.showSimpleAlert(title: "Purchase Complete", message: "Premium has been unlocked successfully.")
+                if selectedPlan == .lifetime, self.storeKitCoordinator.activeNonLifetimePlan != nil {
+                    self.showSimpleAlert(
+                        title: "Lifetime Premium Activated",
+                        message: "You are premium for lifetime now. Please cancel your previous subscription in App Store Subscriptions to avoid future renewal charges."
+                    )
+                } else if selectedPlan == .lifetime {
+                    self.showSimpleAlert(title: "Purchase Complete", message: "Lifetime premium has been unlocked successfully.")
+                } else {
+                    self.showSimpleAlert(title: "Purchase Complete", message: "Premium has been unlocked successfully.")
+                }
                 self.dismissPaywallIfPresented()
                 self.scheduleRatingPromptAfterPremiumUpgrade()
             case .cancelled: