Bläddra i källkod

Align paywall pricing display with PKR formatting and storefront settings.

This keeps the existing price points while ensuring paywall labels and StoreKit-rendered values are shown consistently in PKR for Pakistan testing.

Made-with: Cursor
huzaifahayat12 3 månader sedan
förälder
incheckning
a823c4a6b9
2 ändrade filer med 26 tillägg och 16 borttagningar
  1. 2 2
      meetings_app/StoreKit.storekit
  2. 24 14
      meetings_app/ViewController.swift

+ 2 - 2
meetings_app/StoreKit.storekit

@@ -69,9 +69,9 @@
     "_disableDialogs" : false,
     "_failTransactionsEnabled" : false,
     "_lastSynchronizedDate" : 0,
-    "_locale" : "en_US",
+    "_locale" : "en_PK",
     "_renewalRate" : 0,
-    "_storefront" : "USA",
+    "_storefront" : "PAK",
     "_timeRate" : 0
   },
   "subscriptionGroups" : [],

+ 24 - 14
meetings_app/ViewController.swift

@@ -782,26 +782,36 @@ private extension ViewController {
         }
         let productID = PremiumStoreProduct.productID(for: plan)
         if let product = storeKitCoordinator.productsByID[productID] {
+            let pkrPrice = pkrDisplayPrice(product.displayPrice)
             if product.type == .nonConsumable {
-                return "\(product.displayPrice) one-time purchase"
+                return "\(pkrPrice) one-time purchase"
             }
             if let period = product.subscription?.subscriptionPeriod {
-                return "\(product.displayPrice)/\(subscriptionUnitText(period.unit))"
+                return "\(pkrPrice)/\(subscriptionUnitText(period.unit))"
             }
-            return product.displayPrice
+            return pkrPrice
         }
         switch plan {
         case .weekly:
-            return "Rs 1,100.00/week"
+            return "PKR 1,100.00/week"
         case .monthly:
-            return "Free for 3 Days then Rs 2,500.00/month"
+            return "Free for 3 Days then PKR 2,500.00/month"
         case .yearly:
-            return "Rs 9,900.00/year (about 190.38/week)"
+            return "PKR 9,900.00/year (about 190.38/week)"
         case .lifetime:
-            return "Rs 14,900.00 one-time purchase"
+            return "PKR 14,900.00 one-time purchase"
         }
     }
 
+    private func pkrDisplayPrice(_ value: String) -> String {
+        if value.hasPrefix("PKR ") { return value }
+        if value.hasPrefix("Rs ") {
+            return "PKR " + value.dropFirst(3)
+        }
+        if value.contains("PKR") { return value }
+        return "PKR \(value)"
+    }
+
     private func subscriptionUnitText(_ unit: Product.SubscriptionPeriod.Unit) -> String {
         switch unit {
         case .day: return "day"
@@ -825,14 +835,14 @@ private extension ViewController {
         for (plan, label) in paywallPriceLabels {
             let productID = PremiumStoreProduct.productID(for: plan)
             if let product = storeKitCoordinator.productsByID[productID] {
-                label.stringValue = product.displayPrice
+                label.stringValue = pkrDisplayPrice(product.displayPrice)
             }
         }
         for (plan, label) in paywallSubtitleLabels {
             let productID = PremiumStoreProduct.productID(for: plan)
             guard let product = storeKitCoordinator.productsByID[productID],
                   let period = product.subscription?.subscriptionPeriod else { continue }
-            label.stringValue = "\(product.displayPrice)/\(subscriptionUnitText(period.unit))"
+            label.stringValue = "\(pkrDisplayPrice(product.displayPrice))/\(subscriptionUnitText(period.unit))"
         }
         updatePaywallPlanSelection()
         updatePaywallContinueState(isLoading: false)
@@ -1512,7 +1522,7 @@ private extension ViewController {
 
         let weeklyCard = paywallPlanCard(
             title: "Weekly",
-            price: "Rs 1,100.00",
+            price: "PKR 1,100.00",
             badge: "Basic Deal",
             badgeColor: NSColor(calibratedRed: 1.0, green: 0.60, blue: 0.20, alpha: 1),
             subtitle: nil,
@@ -1523,7 +1533,7 @@ private extension ViewController {
 
         let monthlyCard = paywallPlanCard(
             title: "Monthly",
-            price: "Rs 2,500.00",
+            price: "PKR 2,500.00",
             badge: "Free Trial",
             badgeColor: NSColor(calibratedRed: 0.19, green: 0.82, blue: 0.39, alpha: 1),
             subtitle: "625.00/week",
@@ -1534,7 +1544,7 @@ private extension ViewController {
 
         let yearlyCard = paywallPlanCard(
             title: "Yearly",
-            price: "Rs 9,900.00",
+            price: "PKR 9,900.00",
             badge: "Best Deal",
             badgeColor: NSColor(calibratedRed: 1.0, green: 0.60, blue: 0.20, alpha: 1),
             subtitle: "190.38/week",
@@ -1545,12 +1555,12 @@ private extension ViewController {
 
         let lifetimeCard = paywallPlanCard(
             title: "Lifetime",
-            price: "Rs 14,900.00",
+            price: "PKR 14,900.00",
             badge: "Save 50%",
             badgeColor: NSColor(calibratedRed: 1.0, green: 0.60, blue: 0.20, alpha: 1),
             subtitle: nil,
             plan: .lifetime,
-            strikePrice: "Rs 29,800.00"
+            strikePrice: "PKR 29,800.00"
         )
         contentStack.addArrangedSubview(lifetimeCard)
         updatePaywallPlanSelection()