react-native-iap 8.0.7 → 8.0.8
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/.yarn/install-state.gz +0 -0
- package/ios/RNIapIos.swift +16 -16
- package/package.json +1 -1
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/ios/RNIapIos.swift
CHANGED
|
@@ -236,8 +236,8 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
236
236
|
addPromise(forKey: prod.productIdentifier, resolve: resolve, reject: reject)
|
|
237
237
|
|
|
238
238
|
let payment: SKMutablePayment = SKMutablePayment(product: prod)
|
|
239
|
-
|
|
240
|
-
if #available(iOS 12.2, *) {
|
|
239
|
+
|
|
240
|
+
if #available(iOS 12.2, tvOS 12.2, *) {
|
|
241
241
|
let discount: SKPaymentDiscount = SKPaymentDiscount(
|
|
242
242
|
identifier: discountOffer["identifier"]!,
|
|
243
243
|
keyIdentifier: discountOffer["keyIdentifier"]!,
|
|
@@ -416,7 +416,7 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
416
416
|
reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
|
|
417
417
|
) {
|
|
418
418
|
#if !os(tvOS)
|
|
419
|
-
if #available(iOS 14.0, *) {
|
|
419
|
+
if #available(iOS 14.0, tvOS 14.0, *) {
|
|
420
420
|
SKPaymentQueue.default().presentCodeRedemptionSheet()
|
|
421
421
|
resolve(nil)
|
|
422
422
|
} else {
|
|
@@ -627,7 +627,7 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
627
627
|
return descriptions[0]
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
-
if code > descriptions.count - 1 {
|
|
630
|
+
if code > descriptions.count - 1 || code < 0 { // Fix crash app without internet connection
|
|
631
631
|
return descriptions[0]
|
|
632
632
|
}
|
|
633
633
|
return descriptions[code]
|
|
@@ -654,8 +654,8 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
654
654
|
var periodUnitIOS = ""
|
|
655
655
|
|
|
656
656
|
var itemType = "iap"
|
|
657
|
-
|
|
658
|
-
if #available(iOS 11.2, *) {
|
|
657
|
+
|
|
658
|
+
if #available(iOS 11.2, tvOS 11.2, *) {
|
|
659
659
|
let numOfUnits = UInt(product.subscriptionPeriod?.numberOfUnits ?? 0)
|
|
660
660
|
let unit = product.subscriptionPeriod?.unit
|
|
661
661
|
|
|
@@ -718,22 +718,22 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
718
718
|
introductoryPriceSubscriptionPeriod = ""
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
if #available(iOS 10.0, *) {
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
if #available(iOS 10.0, tvOS 10.0, *) {
|
|
725
725
|
currencyCode = product.priceLocale.currencyCode
|
|
726
726
|
}
|
|
727
|
-
|
|
728
|
-
if #available(iOS 13.0, *) {
|
|
727
|
+
|
|
728
|
+
if #available(iOS 13.0, tvOS 13.0, *) {
|
|
729
729
|
countryCode = SKPaymentQueue.default().storefront?.countryCode
|
|
730
|
-
} else if #available(iOS 10.0, *) {
|
|
730
|
+
} else if #available(iOS 10.0, tvOS 10.0, *) {
|
|
731
731
|
countryCode = product.priceLocale.regionCode
|
|
732
732
|
}
|
|
733
733
|
|
|
734
734
|
var discounts: [[String: String?]]?
|
|
735
|
-
|
|
736
|
-
if #available(iOS 12.2, *) {
|
|
735
|
+
|
|
736
|
+
if #available(iOS 12.2, tvOS 12.2, *) {
|
|
737
737
|
discounts = getDiscountData(product)
|
|
738
738
|
}
|
|
739
739
|
|
|
@@ -763,7 +763,7 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
|
|
|
763
763
|
|
|
764
764
|
|
|
765
765
|
func getDiscountData(_ product: SKProduct) -> [[String:String?]]? {
|
|
766
|
-
if #available(iOS 12.2, *) {
|
|
766
|
+
if #available(iOS 12.2, tvOS 12.2, *) {
|
|
767
767
|
var mappedDiscounts : [[String:String?]] = []
|
|
768
768
|
var localizedPrice: String?
|
|
769
769
|
var paymendMode: String?
|