rampkit-expo-dev 0.0.49 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/RampKitModule.swift +15 -13
- package/package.json +1 -1
package/ios/RampKitModule.swift
CHANGED
|
@@ -471,18 +471,15 @@ public class RampKitModule: Module {
|
|
|
471
471
|
if transaction.isUpgraded {
|
|
472
472
|
eventName = "subscription_upgraded"
|
|
473
473
|
} else {
|
|
474
|
-
|
|
475
|
-
|
|
474
|
+
// Determine event based on product type
|
|
475
|
+
let productType = transaction.productType
|
|
476
|
+
if productType == .autoRenewable {
|
|
476
477
|
if transaction.originalID == transaction.id {
|
|
477
478
|
eventName = "purchase_completed"
|
|
478
479
|
} else {
|
|
479
480
|
eventName = "subscription_renewed"
|
|
480
481
|
}
|
|
481
|
-
|
|
482
|
-
eventName = "purchase_completed"
|
|
483
|
-
case .nonRenewable:
|
|
484
|
-
eventName = "purchase_completed"
|
|
485
|
-
@unknown default:
|
|
482
|
+
} else {
|
|
486
483
|
eventName = "purchase_completed"
|
|
487
484
|
}
|
|
488
485
|
}
|
|
@@ -539,12 +536,17 @@ public class RampKitModule: Module {
|
|
|
539
536
|
|
|
540
537
|
@available(iOS 15.0, *)
|
|
541
538
|
private func mapProductType(_ type: Product.ProductType) -> String {
|
|
542
|
-
switch
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
539
|
+
// Use if-else to avoid switch exhaustiveness issues with resilient enums
|
|
540
|
+
if type == .consumable {
|
|
541
|
+
return "consumable"
|
|
542
|
+
} else if type == .nonConsumable {
|
|
543
|
+
return "non_consumable"
|
|
544
|
+
} else if type == .autoRenewable {
|
|
545
|
+
return "auto_renewable"
|
|
546
|
+
} else if type == .nonRenewable {
|
|
547
|
+
return "non_renewable"
|
|
548
|
+
} else {
|
|
549
|
+
return "unknown"
|
|
548
550
|
}
|
|
549
551
|
}
|
|
550
552
|
|
package/package.json
CHANGED