Ver código fonte

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 1 semana atrás
pai
commit
a823c4a6b9
2 arquivos alterados com 26 adições e 16 exclusões
  1. 2 2
      meetings_app/StoreKit.storekit
  2. 24 14
      meetings_app/ViewController.swift

+ 2 - 2
meetings_app/StoreKit.storekit

@@ -69,9 +69,9 @@
69
     "_disableDialogs" : false,
69
     "_disableDialogs" : false,
70
     "_failTransactionsEnabled" : false,
70
     "_failTransactionsEnabled" : false,
71
     "_lastSynchronizedDate" : 0,
71
     "_lastSynchronizedDate" : 0,
72
-    "_locale" : "en_US",
72
+    "_locale" : "en_PK",
73
     "_renewalRate" : 0,
73
     "_renewalRate" : 0,
74
-    "_storefront" : "USA",
74
+    "_storefront" : "PAK",
75
     "_timeRate" : 0
75
     "_timeRate" : 0
76
   },
76
   },
77
   "subscriptionGroups" : [],
77
   "subscriptionGroups" : [],

+ 24 - 14
meetings_app/ViewController.swift

@@ -782,26 +782,36 @@ private extension ViewController {
782
         }
782
         }
783
         let productID = PremiumStoreProduct.productID(for: plan)
783
         let productID = PremiumStoreProduct.productID(for: plan)
784
         if let product = storeKitCoordinator.productsByID[productID] {
784
         if let product = storeKitCoordinator.productsByID[productID] {
785
+            let pkrPrice = pkrDisplayPrice(product.displayPrice)
785
             if product.type == .nonConsumable {
786
             if product.type == .nonConsumable {
786
-                return "\(product.displayPrice) one-time purchase"
787
+                return "\(pkrPrice) one-time purchase"
787
             }
788
             }
788
             if let period = product.subscription?.subscriptionPeriod {
789
             if let period = product.subscription?.subscriptionPeriod {
789
-                return "\(product.displayPrice)/\(subscriptionUnitText(period.unit))"
790
+                return "\(pkrPrice)/\(subscriptionUnitText(period.unit))"
790
             }
791
             }
791
-            return product.displayPrice
792
+            return pkrPrice
792
         }
793
         }
793
         switch plan {
794
         switch plan {
794
         case .weekly:
795
         case .weekly:
795
-            return "Rs 1,100.00/week"
796
+            return "PKR 1,100.00/week"
796
         case .monthly:
797
         case .monthly:
797
-            return "Free for 3 Days then Rs 2,500.00/month"
798
+            return "Free for 3 Days then PKR 2,500.00/month"
798
         case .yearly:
799
         case .yearly:
799
-            return "Rs 9,900.00/year (about 190.38/week)"
800
+            return "PKR 9,900.00/year (about 190.38/week)"
800
         case .lifetime:
801
         case .lifetime:
801
-            return "Rs 14,900.00 one-time purchase"
802
+            return "PKR 14,900.00 one-time purchase"
802
         }
803
         }
803
     }
804
     }
804
 
805
 
806
+    private func pkrDisplayPrice(_ value: String) -> String {
807
+        if value.hasPrefix("PKR ") { return value }
808
+        if value.hasPrefix("Rs ") {
809
+            return "PKR " + value.dropFirst(3)
810
+        }
811
+        if value.contains("PKR") { return value }
812
+        return "PKR \(value)"
813
+    }
814
+
805
     private func subscriptionUnitText(_ unit: Product.SubscriptionPeriod.Unit) -> String {
815
     private func subscriptionUnitText(_ unit: Product.SubscriptionPeriod.Unit) -> String {
806
         switch unit {
816
         switch unit {
807
         case .day: return "day"
817
         case .day: return "day"
@@ -825,14 +835,14 @@ private extension ViewController {
825
         for (plan, label) in paywallPriceLabels {
835
         for (plan, label) in paywallPriceLabels {
826
             let productID = PremiumStoreProduct.productID(for: plan)
836
             let productID = PremiumStoreProduct.productID(for: plan)
827
             if let product = storeKitCoordinator.productsByID[productID] {
837
             if let product = storeKitCoordinator.productsByID[productID] {
828
-                label.stringValue = product.displayPrice
838
+                label.stringValue = pkrDisplayPrice(product.displayPrice)
829
             }
839
             }
830
         }
840
         }
831
         for (plan, label) in paywallSubtitleLabels {
841
         for (plan, label) in paywallSubtitleLabels {
832
             let productID = PremiumStoreProduct.productID(for: plan)
842
             let productID = PremiumStoreProduct.productID(for: plan)
833
             guard let product = storeKitCoordinator.productsByID[productID],
843
             guard let product = storeKitCoordinator.productsByID[productID],
834
                   let period = product.subscription?.subscriptionPeriod else { continue }
844
                   let period = product.subscription?.subscriptionPeriod else { continue }
835
-            label.stringValue = "\(product.displayPrice)/\(subscriptionUnitText(period.unit))"
845
+            label.stringValue = "\(pkrDisplayPrice(product.displayPrice))/\(subscriptionUnitText(period.unit))"
836
         }
846
         }
837
         updatePaywallPlanSelection()
847
         updatePaywallPlanSelection()
838
         updatePaywallContinueState(isLoading: false)
848
         updatePaywallContinueState(isLoading: false)
@@ -1512,7 +1522,7 @@ private extension ViewController {
1512
 
1522
 
1513
         let weeklyCard = paywallPlanCard(
1523
         let weeklyCard = paywallPlanCard(
1514
             title: "Weekly",
1524
             title: "Weekly",
1515
-            price: "Rs 1,100.00",
1525
+            price: "PKR 1,100.00",
1516
             badge: "Basic Deal",
1526
             badge: "Basic Deal",
1517
             badgeColor: NSColor(calibratedRed: 1.0, green: 0.60, blue: 0.20, alpha: 1),
1527
             badgeColor: NSColor(calibratedRed: 1.0, green: 0.60, blue: 0.20, alpha: 1),
1518
             subtitle: nil,
1528
             subtitle: nil,
@@ -1523,7 +1533,7 @@ private extension ViewController {
1523
 
1533
 
1524
         let monthlyCard = paywallPlanCard(
1534
         let monthlyCard = paywallPlanCard(
1525
             title: "Monthly",
1535
             title: "Monthly",
1526
-            price: "Rs 2,500.00",
1536
+            price: "PKR 2,500.00",
1527
             badge: "Free Trial",
1537
             badge: "Free Trial",
1528
             badgeColor: NSColor(calibratedRed: 0.19, green: 0.82, blue: 0.39, alpha: 1),
1538
             badgeColor: NSColor(calibratedRed: 0.19, green: 0.82, blue: 0.39, alpha: 1),
1529
             subtitle: "625.00/week",
1539
             subtitle: "625.00/week",
@@ -1534,7 +1544,7 @@ private extension ViewController {
1534
 
1544
 
1535
         let yearlyCard = paywallPlanCard(
1545
         let yearlyCard = paywallPlanCard(
1536
             title: "Yearly",
1546
             title: "Yearly",
1537
-            price: "Rs 9,900.00",
1547
+            price: "PKR 9,900.00",
1538
             badge: "Best Deal",
1548
             badge: "Best Deal",
1539
             badgeColor: NSColor(calibratedRed: 1.0, green: 0.60, blue: 0.20, alpha: 1),
1549
             badgeColor: NSColor(calibratedRed: 1.0, green: 0.60, blue: 0.20, alpha: 1),
1540
             subtitle: "190.38/week",
1550
             subtitle: "190.38/week",
@@ -1545,12 +1555,12 @@ private extension ViewController {
1545
 
1555
 
1546
         let lifetimeCard = paywallPlanCard(
1556
         let lifetimeCard = paywallPlanCard(
1547
             title: "Lifetime",
1557
             title: "Lifetime",
1548
-            price: "Rs 14,900.00",
1558
+            price: "PKR 14,900.00",
1549
             badge: "Save 50%",
1559
             badge: "Save 50%",
1550
             badgeColor: NSColor(calibratedRed: 1.0, green: 0.60, blue: 0.20, alpha: 1),
1560
             badgeColor: NSColor(calibratedRed: 1.0, green: 0.60, blue: 0.20, alpha: 1),
1551
             subtitle: nil,
1561
             subtitle: nil,
1552
             plan: .lifetime,
1562
             plan: .lifetime,
1553
-            strikePrice: "Rs 29,800.00"
1563
+            strikePrice: "PKR 29,800.00"
1554
         )
1564
         )
1555
         contentStack.addArrangedSubview(lifetimeCard)
1565
         contentStack.addArrangedSubview(lifetimeCard)
1556
         updatePaywallPlanSelection()
1566
         updatePaywallPlanSelection()