Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
- Using `.activeInCurrentEnvironment` rather than `.active` for RC Purchase Controller
  • Loading branch information
yusuftor committed Nov 13, 2024
1 parent 6200048 commit 298a52e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class RCPurchaseController: PurchaseController {
Task {
for await customerInfo in Purchases.shared.customerInfoStream {
// Gets called whenever new CustomerInfo is available
let hasActiveSubscription = !customerInfo.entitlements.active.isEmpty // Why? -> https://www.revenuecat.com/docs/entitlements#entitlements
let hasActiveSubscription = !customerInfo.entitlements.activeInCurrentEnvironment.isEmpty // Why? -> https://www.revenuecat.com/docs/entitlements#entitlements
if hasActiveSubscription {
Superwall.shared.subscriptionStatus = .active
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extension StoreKit.Product.PurchaseResult {
case .verified(let transaction):
let transactionDate = transaction.purchaseDate
if let purchaseDate = await coordinator.purchaseDate,
transactionDate < purchaseDate {
transactionDate.isAtLeastTwentySecondsBefore(purchaseDate) {
return .restored
} else {
return .purchased
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ enum ProductPurchaserLogic {
guard let purchaseDate = purchaseDate else {
return false
}
// If has a transaction date and that happened at least an hour before purchase
// If has a transaction date and that happened at least 20s before purchase
// button was pressed...
if let transactionDate = transaction.transactionDate,
transactionDate.isAtLeastTwentySecondsBefore(purchaseDate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ extension ProductPurchaserSK1: SKPaymentTransactionObserver {
SKPaymentQueue.default().finishTransaction(skTransaction)
}

func trackTimeout(paywallViewController: PaywallViewController? = nil) async {
private func trackTimeout(paywallViewController: PaywallViewController? = nil) async {
var source: InternalSuperwallEvent.Transaction.TransactionSource = .internal

var isObserved = false
Expand Down

0 comments on commit 298a52e

Please sign in to comment.