Skip to content

Commit

Permalink
Add universal logic for getting monthly and annual susbcription option (
Browse files Browse the repository at this point in the history
  • Loading branch information
miasma13 authored Mar 26, 2024
1 parent 00d3a6f commit 8b7c874
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public final class AppStorePurchaseFlow {

let products = PurchaseManager.shared.availableProducts

let monthly = products.first(where: { $0.id.contains("1month") })
let yearly = products.first(where: { $0.id.contains("1year") })
let monthly = products.first(where: { $0.subscription?.subscriptionPeriod.unit == .month && $0.subscription?.subscriptionPeriod.value == 1 })
let yearly = products.first(where: { $0.subscription?.subscriptionPeriod.unit == .year && $0.subscription?.subscriptionPeriod.value == 1 })

guard let monthly, let yearly else {
os_log(.error, log: .subscription, "[AppStorePurchaseFlow] Error: noProductsFound")
Expand Down

0 comments on commit 8b7c874

Please sign in to comment.